SAN FRANCISCO -- Matt Cain threw a season-high 124 pitches Sunday, but the extra effort was worthwhile.

Making his 15th career start against the Los Angeles Dodgers, Cain finally secured his first victory against the Giants' archrival, allowing four hits in 7 2/3 innings as San Francisco won, 2-0.

Cain's personal milestone, facilitated by Edgar Renteria's sixth-inning triple that drove in both runs, sustained the Giants' seemingly inexorable momentum.

San Francisco completed a three-game series sweep, marking the first time it had run the table at home against the Dodgers since taking four in a row June 21-24, 2004. The Giants last swept the Dodgers in a three-game series April 24-26, 2007, at Los Angeles.

The Giants' 20th victory in their last 25 games kept them 1 1/2 games behind first-place San Diego in the National League West and two games ahead of Cincinnati in the Wild Card race. The Giants completed a 5-2 homestand that improved their overall record to a season-high 16 games above .500 (61-45).

"You're at the stage now where every win is big," Giants manager Bruce Bochy said.

This particular triumph enabled the Giants to dissolve the comfort zone the Dodgers had established here. Entering this series, Los Angeles owned a 26-13 record at AT&T Park since 2006, including a three-game sweep June 28-30.

Cain absorbed the decision in six Giants losses in that span, contributing to his 0-8 record and 4.32 ERA against Los Angeles entering this game. But he established control immediately with a perfect first inning and maintained it by deftly mixing his deliveries. The right-hander permitted only one Dodger to reach scoring position. Cain punctuated a stellar series for San Francisco's starters, as he, Tim Lincecum and Barry Zito combined to yield three runs and 14 hits while striking out 22 in 21 2/3 innings.

"We were working both sides of the plate and trying to get those guys [out] offspeed," said Cain (9-8), who has a 1.54 ERA in four starts since the All-Star break.

Asked whether he felt relieved upon gaining this elusive victory, Cain's initial reaction was a smart-alecky one. "Yeah, so now you guys can't talk about it," he said.

Cain, the player who possesses the longest continuous service with the Giants, ultimately acknowledged the significance of his victory, but didn't dwell on his glory.

Told that Bochy noticed an especially determined look on his face during the game, Cain admitted, "It's obviously been a problem beating [the Dodgers]. It's one of those things where definitely I wanted to go out and win. But we needed to do it more as a group, together. I think that's definitely what happened. Everybody stepped it up huge, made some great plays and got it done."

Cain's primary accomplice was Renteria, the oft-maligned shortstop who launched his big night with a slick play on Russell Martin's second-inning grounder up the middle.

Renteria claimed the spotlight again four innings later. Pat Burrell's one-out double off Dodgers starter Clayton Kershaw (10-6) began the Giants' sixth-inning uprising. With two outs, Kershaw fell behind on the count to Aaron Rowand, 2-0, then elected to walk him intentionally.

Up came Renteria, 0-for-10 lifetime against Kershaw and 4-for-23 (.174) this year with runners in scoring position. No statistics were available for Renteria's performance with a chip on his shoulder, but his attitude turned feisty once Rowand drew his free pass.

"I was pissed off when they did that," Renteria said. "I wanted to do something for the team. Don't wake up the baby. I always like that situation in a clutch game like that."

The man who lined the hit that won the 1997 World Series for the Florida Marlins did it again. He drilled Kershaw's 1-0 pitch to the left-center-field wall, through the early-evening shadows created by the game's 5:10 p.m. PT start and out of center fielder Matt Kemp's reach. Burrell and Rowand scored easily.

Both Bochy and Dodgers manager Joe Torre believed that Kemp had no chance to catch the ball. But Kemp felt otherwise.

"If the sun wasn't right there," Kemp said, "I'm catching that ball."

The sellout crowd roared its approval for Renteria's triple. The Giants celebrated, too, but they weren't necessarily surprised.

"That's what he has done through his entire career," Rowand said. "It doesn't matter what kind of at-bats he had two days before, a day before, the at-bat before, whatever. When those situations come up, the experience and the talent he has come through. He's a big-game player."

And, as Bochy said, every game will be big as long as the Giants remain in contention.

"It's so exciting being where we are, so close to first place," Zito said. "We're not going for the Wild Card. We're going for the whole deal."