PITTSBURGH (AP) -- Yovani Gallardo and the Milwaukee Brewers are proving to be quite a headache for the NL Central's top teams.
Gallardo pitched seven sharp innings and Aramis Ramirez homered against his former club, helping Milwaukee beat the Pittsburgh Pirates 4-0 on Thursday night.
The fourth-place Brewers closed out a 4-2 road trip, taking two of three at third-place Cincinnati before repeating the feat against second-place Pittsburgh.
''It was absolutely a good road trip,'' manager Ron Roenicke said. ''We pitched great in the games we won and our offense, especially the younger guys, continued to do good things.''
The Pirates fell one game behind NL Central-leading St. Louis, which was idle. The Cardinals start a three-game series at Pittsburgh on Friday night.
Making his Pirates debut, John Buck went 3 for 3 while subbing for starting catcher Russell Martin. Pittsburgh acquired Buck and outfielder Marlon Byrd from the New York Mets on Tuesday.
''It kind of gets you into the flow to have a game like this,'' Buck said. ''Now you feel like you're part of the team and it's exciting to be part of this team. I'm really looking forward to the St. Louis series. Games like that are what you play for.''
Gallardo (10-9) allowed six hits and walked one while improving to 11-4 in his career against the Pirates, including a 5-2 record at PNC Park.
Gallardo has given up just two earned runs in 19 1-3 innings in three starts since coming off the disabled list, including a pair of solid outings against the Reds. He was sidelined with a strained hamstring and the injury gave him time to work on his delivery with pitching coach Rick Kranitz.
''Going on the DL took some of the pressure off,'' Gallardo said. ''I wanted to fix everything all at once. Obviously, it's tough to do that when you're getting ready to compete every four or five days against big league hitters. I was able to tweak a few things and now I feel like I'm in the rhythm to be the type of pitcher I can be.''
Brandon Kintzler pitched the final two innings of the six-hitter.
Ramirez hit his ninth home run of an injury-marred season leading off the fourth inning, giving Milwaukee a 3-0 lead. Ramirez, who broke into the major leagues with Pittsburgh in 1998, hit his 350th career homer Tuesday in the series opener.
Pittsburgh rookie Gerrit Cole (6-7) pitched a career-high 7 1-3 innings in his 14th start. He allowed four runs and 10 hits.
''The fifth, sixth and seventh innings were as good as he's been since he got here,'' Pittsburgh manager Clint Hurdle said. ''He did a good job of getting into a groove later in the game and Gerrit gets credit for that and Buck gets credit, too, for working him through some tough spots.''
The 22-year-old Cole was pitching on seven days' rest as the Pirates continue to find spots to limit his workload. Cole has pitched a combined 153 1-3 innings between Pittsburgh and Triple-A Indianapolis after working 132 last year in his first professional season.
A throwing error by Cole led to a first-inning run for Milwaukee. Cole threw wildly to first on a pickoff attempt and Jean Segura advanced two bases before scoring on Jonathan Lucroy's single.
The Brewers added another run in the second when Carlos Gomez led off with a single, stole second and scored on rookie Khris Davis' double.
Lucroy drove in his second run with a sacrifice fly in the eighth.
Scooter Gennett, a rookie second baseman, had three hits for Milwaukee, raising his batting average to .336 in 40 games. Segura and Gomez added two each.
''I like facing guys who throw hard like Cole,'' Gennett said. ''I can gear up for the fastball at 95, 96, 97 and that makes the breaking stuff seems slower than it is.''
Pittsburgh put runners in scoring position in three of the first four innings but came away empty. Gallardo then set down nine of his last 10 batters before being lifted for a pinch hitter.
''There's a concern when your ace isn't pitching like your ace,'' Roenicke said. ''He's been pitching great since he came off the DL. The way he's been pitching now gives all of us, including Yo, a good feeling looking ahead to next season.''
NOTES: Pittsburgh LF Starling Marte, who has been on the disabled list since Aug. 19 with a bruised right hand, has been swinging a bat with his left hand and may be able to start taking batting practice next week, a week earlier than planned. ... Milwaukee RF Norichika Aoki didn't start. He has been getting regular days off to rest his sore right knee. He grounded out when he hit for Gallardo. ... Pittsburgh LHP Francisco Liriano (14-6, 2.74 ERA) is scheduled to start Friday night against St. Louis RHP Shelby Miller (12-8, 2.90 ERA). ... The Brewers face the Los Angeles Angels on Friday in the opener of a three-game series, with RHP Wily Peralta (8-13, 4.51 ERA) going up against RHP Jered Weaver (8-7, 3.46 ERA).