Castro hit a three-run homer and Keuchel pitched seven strong innings to lead Houston to a 4-1 victory against Pittsburgh, handing the Pirates their fifth straight loss.
Keuchel (3-7) gave up four hits for his second win in two starts. He struck out five and walked one.
''He kept us in the game,'' Astros manager Tony DeFrancesco said. ''He made some big pitches when he had to. I thought he was in control the whole game.
''He turned the order over three times, and that's something we are expecting out of him. Hopefully he can be a big part of the rotation next year.''
Castro hit his third homer of the season in the seventh inning, a tiebreaking shot off Pirates right-hander Kevin Correia (11-10) to give the Astros their second lead of the evening.
''We had a bunt put on and took it off, and then the big three-run homer,'' DeFrancesco said. ''And that's been kind a nice winning combination the last couple of weeks here, the three-run homer.
''For the American League next year, I think we are going to need a few more of those to compete with the caliber of players that are going to come in our division.''
Right-handers Hector Ambriz and Wilton Lopez each pitched scoreless innings to secure the win for Houston, with Lopez getting Garrett Jones to fly out to end the game for his seventh save.
Keuchel praised Castro afterwards.
''That's probably the best game I've felt, and I have to give Castro all the credit in the world, because he called a great game,'' Keuchel said.
The Pirates fell 6 1/2 games behind St. Louis for the last NL wild-card spot. Pittsburgh has lost 17 of its last 21 and dropped to 74-77, moving closer to its 20th straight losing season.
''We're making too many mistakes,'' Correia said. ''You can make some of those mistakes when you're banging the ball out of the yard, but we're not doing that.
''I've got to make better pitches, but we've got to play better all around if we're not going to score runs.''
Pittsburgh manager Clint Hurdle was ejected in the second inning for arguing a call at first base. Hurdle argued with first base umpire Tim Timmons, who moments earlier called Michael McKenry out on a throw from first baseman Brett Wallace to Keuchel. The call came after Gaby Sanchez hit a tying home run.
The Astros scored in the first on a double by Scott Moore and a single by Wallace.
Correia was cruising along through six innings - he tied a career high with nine strikeouts - before running into trouble in the seventh.
Jed Lowrie led off with a single and pinch runner Tyler Greene made it safely to second on an error by shortstop Clint Barmes on Matt Dominguez's grounder. Castro's homer soared just high enough to clear the right-field wall and the glove of Garrett Jones.
''I was just looking to advance the runners the best I could,'' Castro said. ''It ended up working out.''
This marked the third time Correia has struck out nine, most recently on July 18, 2010 against Arizona.
The Pirates finished with three errors.
NOTES: Seven-time Cy Young winner Roger Clemens was at Minute Maid Park as many former Astros stars helped celebrate the 50th anniversary of the franchise. The 50-year-old Clemens, who pitched two games for the Sugar Land Skeeters of the independent Atlantic League earlier this year, won't pitch in the majors this season, but refused to rule out a return in the future. ''It's retired for right now,'' he said. ''You guys know me, I'm never going to shut the door on anything because who knows what might happen ... but I'm not getting any younger and it's not getting any easier.'' Other former Astros honored in a pregame ceremony included Jimmy Wynn, Jose Cruz, Jeff Bagwell, Craig Biggio, J.R Richard and Larry Dierker. ... Astros RHP Edgar Gonzalez is day-to-day after exiting Friday night's game in the second inning with a right hamstring strain.
- Dallas Keuchel
- Kevin Correia