PITTSBURGH (AP) A solid road trip kept the Houston Astros on the right path toward a playoff spot.
Evan Gattis hit his 20th home run and Carlos Correa got two hits and scored twice, leading Collin McHugh and the Astros over the Pittsburgh Pirates 5-4.
The Astros won the interleague matchup between wild-card contenders. They went 5-2 on a trip that began in Baltimore.
''I'm really proud of our guys. We have a small margin of error these days and we've responded by playing well,'' manager A.J. Hinch said.
McHugh (8-10) gave up three runs in five innings, ending an 0-4 rut in his last five starts. Ken Giles closed for his fifth save.
Gerrit Cole (7-9) allowed five runs in five innings. He has a 6.07 ERA through five August starts.
Pittsburgh has lost five of six.
''I've been trying to look at approaches and maybe see how I can use my stuff better. I thought today there were some good steps in the right direction: some good sliders, some good curveballs for strikes,'' he said.
''Miss over the plate, and I'm getting punished. That's the bottom line,'' he said.
Gattis homered in the second, connecting after a single by Correa.
''We did a pretty good job of executing some at-bats,'' Hinch said. ''(Cole) has some really good stuff and we stayed enough inside the strike zone. Gattis delivers the big blow. I think that relaxed the dugout a little bit.''
Correa reached on an infield single in the fourth and scored on a triple by Marwin Gonzalez.
George Springer singled to begin the fifth and Alex Bregman followed with a double, setting up sacrifice flies by Jose Altuve and Correa for a 5-1 lead.
Jordy Mercer homered in the Pittsburgh third.
The Pirates closed to 5-3 in the fifth on RBI singles by Starling Marte and Gregory Polanco.
Polanco, who hit two home runs Tuesday, tripled home Marte in the seventh.
''He's continued to find a way to plate runs for us. Using all of the field, doing some nice things,'' Pirates manager Clint Hurdle said.
''It speaks to his mentality to hit the ball hard where it's pitched. He's not just up there trying to yank or drill something into the water. He's up there trying to do some damage, trying to hit the ball hard and he's been doing it quite frequently lately,'' he said.
Astros: Correa was back at shortstop a day after making an early exit because of an illness. Hinch said roughly half of the Astros' roster is currently sick.
Astros: Following a day off, Houston will begin a three-game series at home against Tampa Bay on Friday. After allowing one run through seven innings in his last outing, RHP Mike Fiers (9-6, 4.48) will try to repeat that performance against Tampa Bay.
Pirates: Will travel to Milwaukee for the start of a four-game series against the Brewers on Thursday. RHP Chad Kuhl (3-1, 3.62) will look to bounce back from his first major league loss.