Updated

MILWAUKEE -- Ryan Braun became the Brewers all-time home run leader with his 252nd home run and Khris Davis hit two home runs to help Milwaukee avoid a sweep with an 8-7 victory over the Miami Marlins on Wednesday.

Braun hit a 2-1 pitch from former Brewers starter Chris Narveson to lead off the sixth. Braun broke the tie with Hall of Famer Robin Yount with a blast off the railing of the second deck in right.

Davis teed off on the first pitch from Marlins starter Tom Koehler (8-11) in the second for a two-run homer and then did it again in the third to tie the game at 5-5 with a three-run homer. It was his fourth multi-homer game this season and fifth of his career.

Martin Maldonado put Milwaukee 7-6 ahead with a two-run single off Koehler. One batter later, Narveson relieved with the bases loaded, one out and stranded the three runners.

Wily Peralta (4-7) picked up the win despite surrendering six runs on eight hits over five shaky innings. He walked three and struck out two as the Brewers denied the Marlins their first sweep since May 6-8, 2008 and first at Miller Park since Sept. 1-3, 2006.

The Brewers bullpen preserved the victory with three scoreless innings of relief.

Corey Knebel and Will Smith covered the sixth and Jeremy Jeffress went an inning and 1-3. Francisco Rodriguez had two outs in the ninth when Marcell Ozuna hit a solo home run. Rodriguez recovered, striking out pinch-hitter Casey MeGehee for his 30th save in as many chances.

Justin Bour drove in three runs for the Marlins. He hit a two-run homer in the first and then ground into a fielder's choice that scored Martin Prado for a 6-5 lead in the fifth. Miguel Rojas had a run-scoring single in the second and Connor Gillespie knocked in a run with a double in third.

Koehler lost his season-worst fifth straight game. He's allowed 23 runs over that stretch.

Dee Gordon used a single in the first and triple in the eighth for his 42nd multi-hit game, sharing the NL lead with Cincinnati's Joey Votto.

Adam Lind went 3 for 4 with two singles and a double for Milwaukee.