MILWAUKEE -- The Milwaukee Brewers made things easy Friday night for the Pittsburgh Pirates, who scored five runs on three Brewers errors to roll to an 8-3 victory over the National League Central leaders at Miller Park.

"It wasn't a good game," said Brewers manager Ron Roenicke, whose team has lost two in a row after a five-game winning streak. "We played poor on defense and didn't pitch well."

Milwaukee's defensive gaffes put extra pressure on right-hander Yovani Gallardo, who was 1-0 with a 2.49 ERA in four starts against the Pirates this season and had allowed only two earned runs in his last two starts spanning 15 innings.

Gallardo had to labor Friday and needed 99 pitches to get through a five-inning outing. He walked three and struck out four. Three of his six runs allowed were earned.

"The command wasn't there, especially in that second inning," Gallardo said. "I wasn't throwing balls where I wanted to, and obviously they were up in the zone. Those kind of things can't happen."

Right fielder Ryan Braun gave him an early 2-0 lead after a two-run homer in the first inning, but third baseman Aramis Ramirez opened the second with an error that let catcher Russell Martin reach. Gallardo followed with consecutive walks to first baseman Gaby Sanchez and left fielder Starling Marte before shortstop Jordy Mercer put the Pirates on the board with a sac fly to center.

Gallardo struck out Pirates starter Jeff Locke next, but third baseman Josh Harrison slapped a 1-0 fastball to right that Braun misplayed at the wall. Two runs scored and Pittsburgh took a 3-2 lead.

"It wasn't an easy play," Roenicke said. "It's a long way to run on the track -- it's a big warning track -- it looked like he didn't know exactly where he was on the track and he thought he'd have to go up against the wall, but he had another step."

Harrison finished with a career-high five RBIs, capped by a two-run homer in the eighth inning that followed the second error of the day by Brewers shortstop Jean Segura.

"He's given a lot of people trouble," Roenicke said. "He's having a good year, he's playing good at third. He's doing a great job for them."

The runs burned Gallardo but gave Locke breathing room on a day he didn't have his best stuff.

Locke walked six and didn't strike out a batter but only gave up three hits in his six-inning effort. He was able to work out of jams all night long and got a big boost in the sixth on a failed challenge by Roenicke.

Locke issued consecutive two-out walks to Ramirez and left fielder Khris Davis before Rickie Weeks hit a chopper to shortstop Jordy Mercer.

Mercer's throw to Harrison at third base was high and he needed to make two attempts to step on the base to get Ramirez.

Roenicke challenged third base umpire Will Little's call, but after a two-minute, 33-second review, the call stood and Locke was off the hook.

"I was just hoping the call would go our way," Harrison said. "I caught it and thought I'd stepped on the bag, but I stepped on dirt, so I knew I had to adjust quickly."

Thanks to a loss by the second-place Cardinals, the Brewers maintained their two-game lead in the division. Pittsburgh, which began the day in third place, moved to four games back.

NOTES: Brewers RHP Kyle Lohse reported no problems after a bullpen session Friday afternoon and is expected to return to the rotation Monday at San Diego. Lohse missed his last start because of a sore ankle that had bothered him since an Aug. 2 start against the Cardinals. ... Milwaukee manager Ron Roenicke said RHP Matt Garza will throw a bullpen session Sunday and could rejoin the team in early September. Garza has been on the disabled list since Aug. 5 with a strained left oblique. ... Pirates RHP John Axford returned to Milwaukee, where he saved a club-record 45 games for the Brewers in 2011 and was 21-19 with a 3.35 ERA and 116 saves in five seasons before being dealt to St. Louis last August. ... The Pirates' next 15 games will come against National League Central opponents.