LOS ANGELES -- Manuel Margot continued to show he is a keeper for the San Diego Padres with his second multi-home run game of the season.

The rookie center fielder hit two homers Friday night as the Padres showed some resiliency in a 4-3 win over the Los Angeles Dodgers, who have the best record in baseball.

But the biggest home run of the night was delivered by Jose Pirela, who gave the Padres the lead for good with a shot into the field-level seats in left field in the eighth inning off reliever Ross Stripling.

The Dodgers right-hander also gave up Margot's second home run of the game.

The loss spoiled a solid outing from Dodgers starter Rich Hill, who remained in the game despite getting hit on the neck by a Clayton Richard pitch in the fourth inning. The left-hander squared around to bunt when the Richard pitch glanced off his throat.

Hill struck out nine batters but lacked the sharpness he showed in July while winning National League pitcher of the month honors. He gave up two runs, five hits and three walks, his highest walk total since he had three on June 21.

The Dodgers lost at home for just the 14th time all season and went down in their own park for the first time since July 21 against the Atlanta Braves. The defeat snapped their eight-game home win streak.

Despite giving up four walks and eight hits, Richard kept the damage to a minimum, allowing three runs in six innings.

The Dodgers once again got an early lift from rookie sensation Cody Bellinger, but this time it did not come from his impressive power swing. Bellinger's first-inning RBI single gave Los Angeles a 1-0 lead.

Margot hit his first home run of the night in the third inning, giving him 11 for the season. Corey Spangenberg gave the Padres a 2-1 lead, delivering one run in the single when Dodgers right fielder Yasiel Puig threw out Hunter Renfroe at the plate.

Bellinger was at it again in the Dodgers' half of the third, contributing his second RBI single of the night. It was the young slugger's 21st multi-RBI game of the season and third in his last six games.

An Austin Barnes RBI double gave the Dodgers a 3-2 lead in the fifth inning, but Margot answered in the seventh with his second home run of the game and 12th of the season, off Stripling. It was Margot's second two-homer game this year.

Pirela added a homer in the eighth to give the Padres a 4-3 lead.

NOTES: In 10 home starts this season, Dodgers LHP Rich Hill is 5-3 with a 3.17 ERA and has held batters to a .189 average. ... Dodgers C Austin Barnes, who delivered an RBI double in the fifth inning, has gone 8-for-17 (.471) in his last five games against the Padres with two doubles, two homers and eight RBIs. ... Padres LHP Brad Hand posted his ninth save of the year and delivered his third career four-plus out save. ... Since July 19, Padres CF Manuel Margot is batting .316 (24-for-76) with 11 runs, three doubles, seven homers and 13 RBIs. ... The Dodgers were 19-0 when 1B Cody Bellinger had two RBIs in a game, losing for the first time this season when the rookie drove in multiple runs.