Updated

Center fielder Cameron Maybin robbed Matt Kemp of a go-ahead homer in the seventh inning after Carlos Quentin put San Diego ahead with a sacrifice fly, and the Padres beat the Los Angeles Dodgers 4-3 Wednesday night to take two of three games in the series.

The loss kept the Dodgers 4½ games behind the first-place Giants in the NL West, with a pivotal three-game series between the storied rivals starting Friday night at San Francisco. Los Angeles remained 1½ games behind St. Louis for the second wild card.

Nick Vincent (2-0) retired all four batters he faced after relieving starter Clayton Richard with two outs in the fifth. Fellow rookie Brad Boxberger struck out Shane Victorino and walked Adrian Gonzalez to open the seventh, and Kemp followed with a long drive to center. Maybin timed his leap perfectly before pulling it down.

Rookie left-hander Tommy Layne, the seventh Padres pitcher, got the more conventional save by retiring Gonzalez on a one-hopper to second base after Luke Gregerson hit Victorino on the foot with an 0-2 pitch with two outs in the ninth. It was Layne's second save in two opportunities with All-Star closer Huston Street on the disabled list because of a strained left calf.

Dodgers reliever Shawn Tolleson (1-1), who allowed seven runs and nine hits in 4 1-3 innings over his previous four appearances, struck out the side on 15 pitches in the sixth after replacing starter Aaron Harang. But the rookie right-hander gave up a leadoff walk in the seventh to Will Venable, who stole second and scored on Quentin's sacrifice fly after being held at third on Chase Headley's single.

Richard had a 3-0 lead before he threw his first pitch. Everth Cabrera scored on Headley's double off the center-field fence, and Venable followed him home as the relay throw from shortstop Hanley Ramirez skipped past catcher A.J. Ellis for an error. Yasmani Grandal drove in Headley with an infield single to the right side.

Richard gave up singles to his first three batters in the second, including a run-scoring hit by Luis Cruz. The left-hander also yielded singles to his first three batters in the third, including a run-scoring hit by Gonzalez that trimmed San Diego's lead to 3-2.

Victorino went to third on Gonzalez's hit, then got caught in a rundown on Kemp's grounder to first. Moments later, Richard wriggled out of a bases-loaded jam.

Harang gave up three runs — two earned — and seven hits in five innings. It was the seventh straight outing in which the right-hander failed to get through the seventh.

Victorino saved two runs with a running grab in the fifth, then led off the bottom half with an infield hit. He scored from third on Ramirez's single to make it 3-all.

Richard was charged with three runs and 10 hits over 4 2-3 innings in his fifth start against the Dodgers this season.

NOTES: Headley needs six RBIs to join Ken Caminiti and Phil Nevin as the only Padres third basemen to drive in 100 runs in a season. ... The Padres and OF Chris Denorfia agreed to a $4.25 million, two-year contract that runs through the 2014 season. ... Six current members of the Padres' bullpen made their major league debuts this season: Layne, Vincent, Boxberger, Cory Burns, Casey Kelly and Miles Mikolas. Brad Brach and Dale Thayer also have rookie status, despite having pitched in the majors last season. ... Dodgers LHP Chris Capuano, whose next scheduled start is Saturday at San Francisco, has faced 85 batters over his last three outings while going 21 innings without a walk.