SAN FRANCISCO — Bruce Bochy said all along the NL West race would probably come down to the final weekend, and it will.
Bochy's Giants are in prime position to win the division, needing only one win against the visiting Padres in their season-ending three-game set.
Pablo Sandoval hit a splash shot into McCovey Cove, Andres Torres and Buster Posey also homered and the Giants beat Arizona 4-1 Thursday, moving them closer to their first NL West crown since 2003.
"We've got to go out there and go hard," Bochy said. "Yeah, we put ourselves in good position, but we've got games ahead of us. They know it. They're very much aware of where we're at."
San Francisco now has a three-game edge over San Diego, which lost 1-0 to the Cubs.
The Giants completed a three-game sweep, won their fourth straight and cut their magic number to one.
Matt Cain starts tonight's series opener, and possible clincher, for San Francisco.
"We've put ourselves in a good situation and got done what we needed to get done," Cain said. "I've got to go and do the same things I've done before. Same preparation."
Torres' go-ahead, solo homer in the fifth inning helped rookie Madison Bumgarner earn his first home victory in eight tries. Posey hit a two-run homer in the sixth, the rookie's seventh shot in September.
Overall, the Giants have hit 16 home runs in their last seven games. Former Ray Pat Burrell had a three-run drive Wednesday night.
Sandoval's solo shot into the water beyond rightfield came with two outs in the second. It was the first home run for the struggling slugger since Aug. 28, a 66 at-bat homerless stretch. Sandoval has just 12 hits in his last 63 at-bats. He insists he is more relaxed lately and finding his stroke again.
"This is the same Pablo as last year," he said.