Updated

Bruce Bochy has said all along the NL West race would probably come down to the season's final weekend — and it will.

His San Francisco Giants have put themselves in prime position: They need only one victory against visiting San Diego in their season-ending three-game series to win the division and end a six-year playoff drought.

Pablo Sandoval hit a splash shot into McCovey Cove, Andres Torres and Buster Posey also homered and the Giants beat Arizona 4-1 on Thursday, moving them closer to their first NL West crown since 2003.

Bochy said the days of team meetings are over. His players understand the stakes.

"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's win, coupled with San Diego's 1-0 loss to Chicago later Thursday, left the Giants' magic number to win the division at one. Even if the Padres sweep this weekend's three-game series in San Francisco, the teams would be tied for the title.

The Giants completed a three-game sweep over the Diamondbacks, won their fourth straight and eighth in 10.

Matt Cain (13-10) starts Friday night's series opener for San Francisco. It could be to clinch — and it's expected to be an electrifying scene at AT&T Park for all three sold-out games.

"We've put ourselves in a good situation and got done what we needed to get done today," 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 (7-6) 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. Pat Burrell had a three-run drive Wednesday night.

"We have one guy hitting a home run one night and another guy hitting a home run another night," Sandoval said.

Barry Enright (6-7) lost his fifth straight start. He has given up 12 homers during that span after surrendering just eight longballs in his previous 12 outings.

"We want to be in their position next year," Enright said. "We still have a few games left but it's exciting to think about some of the guys coming back next year."

New Arizona general manager Kevin Towers said he hopes to decide on a manager "shortly after the season" ends. He has spent time in recent days with interim Kirk Gibson, who hopes to stay on for 2011.

Sandoval's solo shot into the water beyond right field with two outs in the second prompted one of two kayakers paddling for the ball to jump out of his boat and swim to snag the souvenir.

It was the first home run for the struggling slugger since Aug. 28, a homerless stretch of 66 at-bats. 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.

Sandoval connected for his fourth career splash hit and second this year. It was the fifth by a Giant in 2010, 55th by San Francisco overall and 77th total in the 11-year ballpark's history. Barry Bonds, the home run king, has 35 of them.

Arizona loaded the bases against Bumgarner in the fourth, getting Enright's sacrifice fly to tie it at 1.

Bumgarner had been 0-3 at home with a 4.95 ERA before winning Thursday. He struck out seven and walked one in five innings, allowing seven hits and one run.

The 21-year-old lefty pitched on an extra day's rest after he had his start pushed back a day as ace Tim Lincecum pitched Wednesday night on normal rest. Bumgarner has allowed only five earned runs in his last 38 innings over his last six starts.

"It feels pretty good," he said of the Giants' position. "We're going to try to get it tomorrow, but we're not penciled in yet."

Ramon Ramirez pitched the ninth for his third save in as many tries as the Giants completed their third sweep of the season against Arizona. With a three-run cushion, Bochy gave All-Star closer Brian Wilson a break after he saved back-to-back games with a five-out effort Tuesday.

Moments after the final out, three concession workers on the lower concourse raised brooms into the air and chanted "Sweep! Sweep!"

Arizona struck out 12 times after 14 Ks in Wednesday's 3-1 loss. The Giants' pitching staff has a majors-best 1,306 strikeouts and established a San Francisco single-season franchise record, topping last year's total of 1,302.

Notes: Posey also hit seven home runs in July. He'd been in a 1-for-19 stretch before the homer. ... 2B Freddy Sanchez returned to the Giants' starting lineup after missing the first two games of the series with a strained right shoulder. ... Struggling 3B Mark Reynolds was back in the D-backs' starting lineup after missing three straight starts with a sore thumb. He is in an 0-for-19 funk and 3 for his last 34.