San Francisco hit four homers at home for the first time in more than two years