LOS ANGELES — That beleaguered bullpen is a Giant problem for San Francisco.

Adrian Gonzalez hit a game-winning double in the ninth inning and the Los Angeles Dodgers rallied past San Francisco for a testy 2-1 victory Monday night that increased their NL West lead to six games.

San Francisco has lost nine times this season when leading after eight innings, setting an unwanted franchise record.

“Everyone’s grinding blood, sweat and tears for nine innings. You kind of let your teammates down,” said reliever Derek Law, who gave up a leadoff single to pinch-hitter Andrew Toles in the ninth. “That was a tough one. We’ve been having tough ones.”

Since Aug. 13, the bullpen’s ERA has topped 6.00 in the ninth or later compared to a 1.51 mark in all other innings during that span.

“Those last three outs, I don’t know that I’ve ever seen such a tough time getting them, but we’re having it,” Giants manager Bruce Bochy said. “It’s a shame because we played great. They did a good job, manufactured a run, and we couldn’t hold on there.”

Two innings after a shoving match broke out when tempers flared between Madison Bumgarner and Yasiel Puig again, the Dodgers rallied in the ninth.

After Toles’ hit, Corey Seager singled past diving second baseman Joe Panik on a two-strike pitch from Javier Lopez (1-3), allowing the speedy Toles to reach third.

Justin Turner’s single tied the game, and Gonzalez followed with a drive to deep right field that eluded Hunter Pence.

Joe Blanton (6-2) won in relief following a tense pitchers’ duel between Bumgarner and fellow ace Clayton Kershaw.

Both benches and bullpens cleared during the seventh-inning scuffle.

Bumgarner fielded a slow tapper by Puig along the first base line and threw him out to end the inning. The left-hander punched his glove emphatically and said something that didn’t appear very cordial.

“I didn’t hear what was going on,” Bumgarner said. “I just got him out and he tried to stare me down or something. That’s what it looked like to me.”

Puig glared back and responded, and soon both teams massed near first base before the dustup ended without any punches.

“He asked me, ‘Why you looking at me?'” Puig said through a translator. “I asked him why he was looking at me.”

In the second, Puig doubled for the lone hit given up by Bumgarner.

“Maybe because it was his only hit and he was angry,” Puig said. “Every time I face him it seems like we have those problems. We’re tired of it. It definitely motivates us and seems to have a distraction in their head.”

Bumgarner allowed one hit over seven scoreless innings. He struck out 10, walked none and retired his final 10 batters.

Kershaw gave up an unearned run and three hits over six innings in his third start since returning from a back injury. He struck out seven and walked one. The three-time NL Cy Young Award winner retired seven in a row before leaving.

The Giants led the division by 6 1/2 games at the All-Star break but lost the lead to the Dodgers on Aug. 21. Since the lead changed hands, San Francisco has dropped 16 of 27 and the Dodgers have won 18 of 28. They play each other five more times over their final 12 games.

TRAINER’S ROOM

Dodgers: LHP Hyun-Jin Ryu (elbow) and RHP Brandon McCarthy (hip stiffness) will pitch in a simulated game Tuesday. … LHP Alex Wood (elbow surgery) will be activated Tuesday. The team wanted an extra day to finalize the corresponding roster move. … Manager Dave Roberts said LHP Scott Kazmir (neck inflammation) shouldn’t be affected by a finger blister that he developed Sunday in a simulated game. … LHP Julio Urias will pitch out of the bullpen during the Giants series. … The team hasn’t decided when LHP Brett Anderson (finger blister, back surgery) will return.

UP NEXT

Giants: RHP Johnny Cueto (16-5, 2.86 ERA) has a 1.69 ERA in his last three starts against the Dodgers. The two-time All-Star pitched his fifth complete game of the season in his last start on Thursday against St. Louis.

Dodgers: LHP Rich Hill (12-4, 2.06 overall after trade from Oakland) is 3-1 with a 2.70 ERA in six career starts against the Giants, limiting their hitters to a .219 batting average and striking out 31 against nine walks in 40 innings.