Houston's Gerrit Cole tried not to think too much about what it would be like to face his former team leading up to Tuesday night's meeting with the Pittsburgh Pirates.

After turning in a solid performance to lead the Astros to a 5-1 win over the Pirates he allowed himself a little time to reminisce, saying that there was probably a lot of emotions on both sides.

"It was unique," he said. "I remember facing these guys in spring training and throwing live BPs and throwing (simulated) games and coming up with some of them. There's just a lot of memories that you have."

Cole (7-5) yielded seven hits and one run in six innings against the team which drafted him first overall in 2011 and where he spent five seasons before a trade to Houston before last season. Cole struck out three and walked two as he won his third straight decision.

"He mixed all his pitches in," Pittsburgh manager Clint Hurdle said. "He threw some change-ups, threw some curveballs, used the slider. Fastball was elevated, good velocity, good life. One of those games where at the end of the day, you're looking for the big hit and we didn't get it."

Yuli Gurriel and Alex Bregman homered to back up Cole and help the Astros to the win.

After winning just one time on a seven-game road trip which ended Sunday, the Astros opened a six-game homestand with the victory over the Pirates, who came into town on a four-game winning streak. Houston reached 50 wins on Tuesday night to join the Dodgers, Twins and Yankees as the only teams to reach the mark this season.

Bregman got things going in the fourth with a double off Trevor Williams before Gurriel launched a fastball into the seats in left field with two outs in the inning to make it 2-0.

An RBI single by Melky Cabrera got the Pirates within 1 in the sixth before Bregman opened the bottom of the inning with his 22nd home run to make it 3-1.

Williams (2-2) allowed eight hits and four runs in 6 2/3 innings.

"There are a few balls I wish I would have gotten back ... they put together some tough ABs off of me, especially late," Williams said.

Houston added a run on a sacrifice fly by Robinson Chirinos for the second out of the seventh inning and Williams was lifted when George Springer singled after that.

It was the only hit of the night for Springer, who returned to the lineup on Tuesday for the first time since straining his left hamstring on May 24.

Cole got a big assist from his defence in the fourth inning when Josh Reddick reached over the short wall in right field to rob Starling Marte of a home run for the first out of the inning.

"At the very last second it took a hard right turn," Reddick said. "Kind of unexpected for me because I thought I had a good shot at it and all of the sudden I had to quick jump. And it wasn't the prettiest, cleanest of catches but I caught it. That's all that matters."

Cole didn't allow more than one baserunner in an inning until the fifth when José Osuna singled with one out before Elias Díaz walked. But the Pirates came away emptyhanded when Cole retired Adam Frazier before striking out Kevin Newman to end the inning.

Corey Dickerson doubled to start the sixth and advanced to third on a groundout by Marte. The Pirates cut the lead to 1 when Dickerson scored on the ground ball single by Cabrera with two outs in the inning. Colin Moran singled after that before Cole walked Osuna to load the bases. But he was able to limit the damage when Díaz grounded out.

The Astros padded the lead on an RBI double by rookie Yordan Alvarez with no outs in the eighth.

TRAINER'S ROOM

Astros: RHP Collin McHugh, who hasn't pitched since May 14 because of a sore right elbow, was activated from the injured list on Monday and pitched a scoreless ninth.

INTERLEAGUE SUCCESS

The Astros are 59-30 in interleague play since 2015. That's the second-best record in that span behind the Red Sox, who are 61-24.

UP NEXT

Pirates: RHP Dario Agrazal (0-0, 4.50) will be recalled from Triple-A Indianapolis to start for Pittsburgh on Wednesday night. Agrazal allowed six hits and three runs — two earned — in four innings against the Marlins on June 15 in his major league debut.

Astros: LHP Framber Valdez (3-3, 3.61) is scheduled to start for Houston on Wednesday. Valdez yielded four hits and five runs in 3 1/3 innings of a 10-6 loss to the Yankees in his last start.