MILWAUKEE — Robbie Ray convinced Diamondbacks manager Torey Lovullo to allow him to finish the fifth inning, and it paid off.
Ray returned from the injured list and pitched five scoreless innings, Eduardo Escobar and Christian Walker each homered, and Arizona beat the Milwaukee Brewers 5-2 Sunday to avoid a series sweep.
"I bartered with him. I negotiated with him," said Lovullo of Ray before sending the left-hander out in the fifth. "He doesn't let me down very often."
Ray (11-7) had been out since Aug. 14 due to lower back spasms. He allowed three hits, walked four and struck out six on 103 pitches.
"It felt good to get back out there and help the team get a win," Ray said. "I felt like my stuff was good. I felt like I was around the zone all day today. They took some really good at-bats, laid off some really good pitches, but overall I felt like I pitched really well."
Ray has thrown 18 2/3 consecutive scoreless innings against the Brewers.
The win puts the Diamondbacks 4 ½ games back of the Cubs in the race for the second NL wild-card spot. Chicago lost to Nationals 7-5 Sunday in extra innings. Milwaukee remained two games behind the Cubs.
After scoring one run over the first two games of the series, Arizona scored twice in the first inning. Ketel Marte led off with a single, Tim Locastro reached on a fielder's choice and Walker hit a drive to the left field bleachers. It was Walker's 23rd home run of the season and his fourth of the team's eight hits in the series at that point.
Escobar added on in the fourth with his 29th homer. Walker then reached on a double and came around to score on a fielder's choice to make it 4-0.
That spelled the end for Brewers starter Zach Davies (8-7), who has lost five straight starts.
Marte scored another run for the Diamondbacks in the fifth on an error by second baseman Keston Hiura. Marte opened the inning with a double off Taylor Williams.
Manny Pina gave Milwaukee its first run in the seventh with his seventh home run. Ryan Braun added another run in the eighth, scoring Hiura on a sacrifice fly. Both runs came off of Yoan Lopez.
Braun, who had a double and a single on the day, has hit safely in each of his last 17 starts.
Christian Yelich had two hits and his 25th stolen base. The reigning NL MVP stepped to the plate with two on in the bottom of the ninth but grounded out for the final out.
"We had, what, four at-bats with the tying run at the plate?" Brewers manager Craig Counsell said. "We did a good job battling back and scoring some runs and having some innings where something good was one hit away from happening. We just couldn't finish it."
Archie Bradley picked his seventh save in 10 chances.
Milwaukee star Yasmani Grandal went hitless on his bobblehead day.
Brewers: RHP Jeremy Jeffress was placed on the 10-day IL with a strained left hip. RHP Ray Black was recalled from Triple-A San Antonio. Jeffress said his hip started acting up last week in Washington. He said he's hopeful of a minimum 10-day absence.
Diamondbacks: LHP Alex Young (5-3, 4.04 ERA) will get the ball Monday in San Francisco. Young is 3-1 with a 3.27 ERA in four road starts this season. He's 1-1 with a 5.40 ERA against the Giants.
Brewers: LHP Gio Gonzalez (2-1, 3.64) will take the mound Monday against RHP Adam Wainwright (9-9, 4.51) and the NL Central-leading Cardinals. Gonzalez allowed one earned run on three hits, walked four and struck out six in five innings in a no-decision against St. Louis on Tuesday.