One possibility is gsub
:
gsub(pattern = ".y", replacement = "", x = names(dat), fixed = TRUE)
# [1] "x1" "id" "av1" "av2" "av3" "av4"
More explicitly match of ".y" at the end of the string:
gsub(pattern = "\\.y$", replacement = "", x = names(dat))