PHOENIX (AP) -- Martin Prado lined a two-run single in the eighth inning, Wade Miley pitched eight effective innings and the Arizona Diamondbacks ended a three-game losing streak with a 5-3 win over the Milwaukee Brewers on Thursday night.
Miley (6-7) gave up a pair of homers in the first three innings before settling down.
Adam Eaton helped Arizona close to 3-2 with a two-run triple in the fifth inning, Jason Kubel tied it with a sacrifice fly the next inning and Prado capped the comeback with the bases loaded against Jim Henderson (3-3) in the eighth.
Brad Ziegler worked around two baserunners in the ninth to earn his second save, a night after Heath Bell blew a save with two outs in the ninth in a loss to the Dodgers.
Jonathan Lucroy hit a two-run homer and Carlos Gomez had a solo shot for the Brewers.
The Diamondbacks were a bit thin on pitchers for the series opener after using eight in Wednesday night's 7-5, 14-inning loss to the Dodgers. They also figured to be a bit tired following the five-hour game that ended after midnight.
Miley didn't look like he'd be much help the first few innings.
He gave up four hits in the first, the big blow a two-run homer by Lucroy that sailed well over the wall in the deepest part of the park in center.
Miley survived being hit on the foot on Norichika Aoki's infield single in the second inning, but not another pitch left up in the zone in the third, this one to Gomez, who hit it out for a solo homer that put the Brewers up 3-0.
Miley found a rhythm after that, retiring 13 straight batters - with help from a diving catch by Gerardo Parra in right in the seventh inning - until Aoki led off the eighth with an infield single.
Miley allowed three runs and eight hits. Ziegler got the final two outs with runners on the corners to finish it off.
Brewers starter Yovani Gallardo has dominated the Diamondbacks during his career, going 6-0 with a 1.62 ERA in eight career starts before Thursday.
He was sharp early against Arizona again, getting the Diamondbacks to pound balls into the ground while holding them hitless until Paul Goldschmidt's one-out single in the fourth inning.
The Diamondbacks strung together a couple of hits in the fifth inning and Eaton, playing his third game since coming off the DL, reached down for a two-run triple for his first hit of the season.
Kubel tied it with a sacrifice fly off Gallardo in the sixth inning.
Gallardo allowed three runs and four hits in six innings.
NOTES: Brewers LF Ryan Braun, who was expected to return to the lineup after missing a game with a sore thumb, will be out at least three games on bereavement leave. The Brewers said he left the team to attend to a family medical issue. ... Arizona 2B Aaron Hill was 0 for 4, the first time in 13 career games against Milwaukee he's failed to get a hit. ... Arizona LHP Patrick Corbin will make his first start since being named to the NL All-Star team in the second game of the series Friday night. He is the fourth Diamondbacks pitcher to win 10 games before the All-Star break, first since Brandon Webb went 13-4 in 2008. ... Brewers LHP Tom Gorzelanny will start against Arizona on his 31st birthday. He allowed two runs in six innings of a 2-1 loss to the Mets on Sunday.