PITTSBURGH -- Yovani Gallardo is starting to pitch like an ace again for the Milwaukee Brewers.
The right-hander continued his late-season surge Thursday night, pitching seven effective innings to beat the Pittsburgh Pirates 4-0 at PNC Park.
Gallardo (10-9) scattered six hits, walked one walk and struck out five.
It has been an up-and-down year for Gallardo after he was combined 60-38 over the previous four seasons. However, in three starts since coming off the disabled list after being sidelined by a hamstring injury, he has allowed just two earned runs in 19 1/3 innings (0.93 ERA).
Gallardo got stronger as Thursday's game went on, retiring nine of the last 10 batters he faced.
"There's a concern when your ace isn't pitching like your ace," Brewers manager Ron 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."
Gallardo believes the time on the DL turned out to be a blessing in disguise because he put in extra work with pitching coach Rick Kranitz on correcting some mechanical flaws in his delivery.
"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-hit shutout.
Pittsburgh dropped one game behind first-place St. Louis, which was idle, in the National League Central race. The Pirates host the Cardinals in a three-game series beginning Friday night.
"There are days when you have to give the other pitcher credit because he throws well and executes pitches," Pirates manager Clint Hurdle said. "This is one of those days. Gallardo pitched well."
Rookie second baseman Scooter Gennett had three hits for the Brewers to raise his batting average to .340, while Jean Segura and Carlos Gomez added two hits each. Aramis Ramirez homered, and Jonathan Lucroy drove in two runs.
Catcher John Buck had three hits in his Pirates debut, two days after he and right fielder Marlon Byrd were acquired in a trade from the New York Mets for two minor league prospects.
"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."
Pittsburgh rookie Gerrit Cole (6-7) gave up more than three runs for just the second time in 14 career starts, as he allowed four -- three earned -- in a career-high 7 1/3 innings. Pitching on seven days of rest as the Pirates continue to find ways to limit the 22-year-old's workload, Cole walked one, struck out four and permitted 10 hits.
It was first time Cole lost in five decisions while pitching with six days of rest or more. He also lost for the seventh time in his last nine decisions since beginning his career in June by winning his first four starts.
Milwaukee took advantage of a throwing error by Cole to score a first-inning run. Cole make a wild pickoff throw to first base, allowing Segura to advance to third, and Segura scored on Lucroy's single.
In the second inning, Khris Davis doubled home Carlos Gomez, who singled and stole second. It was the Brewers' first hit on a 3-0 count all season.
Ramirez led off the fourth with his ninth home run of the season to increase Milwaukee's lead to 3-0.
Lucroy's eighth-inning sacrifice fly capped the scoring.
The Pirates lost two out of three to the Brewers and missed a chance to tie St. Louis going into the big weekend series.
"At any point when you're playing teams within the division, there's always that competitiveness, whether it's the first week of the season or the last," Gallardo said.
NOTES: Pittsburgh LF Starling Marte, who has been on the disabled list since Aug. 19 with a bruised right hand, is 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 got most of the game off, grounding out as a pinch hitter in the eighth inning. He has been getting regular days off to rest his sore right knee. ... 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). ... The Brewers play host to the Los Angeles Angels on Friday in the opener of a three-game series, with RHP Wily Peralta (8-13, 4.51) facing RHP Jered Weaver (8-7, 3.46).