Updated

Anthony Rizzo went 2-for-4 with a double and two RBI to lead the Chicago Cubs to a 5-4 win over the Milwaukee Brewers on Wednesday.

Luis Valbuena had two hits and an RBI, while Ryan Sweeney hit a solo home run and Darwin Barney drove in one run for the Cubs, winners in three of their last five games.

Scott Feldman (7-6) gave up three runs on six hits while fanning three over six innings. Kevin Gregg gave up a solo homer, but stranded a runner in the ninth to earn his 12th save of the season.

"(Feldman) has done a great job. He can manage an inning when things start to go haywire," said Cubs manager Dale Sveum.

Aramis Ramirez went 2-for-4 with a homer and two RBI and Juan Francisco added a solo shot for the Brewers, who had won three of four entering the contest.

Yovani Gallardo (6-7) gave up five runs -- three earned -- on eight hits and four walks over four innings to absorb the loss.

Chicago scored a pair of runs in the second inning. Welington Castillo singled then scored on Barney's double to center. Barney then came around on a Valbuena base hit up the middle to make it 2-0.

Ramirez smacked his solo shot in the bottom half of the second to make it 2-1. It was the 2,000th career hit for Ramirez.

Sweeney smacked a leadoff homer in the third to put the Cubs up three runs, but Norichika Aoki doubled home Caleb Gindl in the home half to make 3-2.

Chicago plated two more in the fourth inning to take a 5-2 edge. With the bases loaded, Rizzo laced a two-run single to center to score Valbuena and Starlin Castro.

Ramirez's RBI single in the sixth scored Jean Segura to pull the Brewers within 5-3.

Francisco cracked a leadoff homer in the ninth to pull Milwaukee within 5-4. Rickie Weeks followed with a double to right-center and moved to third on a Logan Schafer sacrifice bunt.

Yuniesky Betancourt followed with a grounder to Valbuena, who fired home to catch Weeks. Gregg then got Scooter Gennett to fly out to end the game.

"That was what (Weeks) was supposed to do, go on contact. We've been hitting balls right at people," said Brewers manager Ron Roenicke. "You hope that it is hit a little to the side of him or in between so the fielder has to move a couple of steps, but the main thing is to try an hit it in the air in that situation."

Game Notes

The Cubs are 51-54 at Miller Park (since 2001) ... Gregg has converted all 12 of his save opportunities this season ... Chicago starters have thrown 46 quality starts this season ... Segura and Weeks extended their hitting-streak to nine and 10 games, respectively ... Gallardo lost for the first time since June 5.