Bedard (3-3) allowed seven hits and walked one, but limited St. Louis to three runs. Three relievers then combined to pitch two hitless innings before Jose Veras worked the ninth for his 16th save.
Allen Craig homered for the second straight night and Yadier Molina had a two-run shot for the Cardinals, who lost for the fourth time in five games. They dropped into a tie with surging Pittsburgh for the lead in the NL Central.
Lance Lynn (10-2) allowed five hits and four runs, walked four and struck out four over 7 2-3 innings for his first loss in four career starts in Houston.
Molina and Craig helped the Cardinals get off to a nice start. Molina followed Carpenter's leadoff single with a drive to the Crawford Boxes in left field for his sixth homer. Craig had a leadoff drive in the fourth that bounced off the lights atop the wall in left field, extending the lead to 3-0.
But Houston responded in the bottom half. Jose Altuve and Jason Castro got it started with back-to-back singles for the Astros' first hits of the game. Lynn then walked Chris Carter on four pitches to load the bases before sending a run home when he also walked Carlos Pena on four pitches.
Castro came home when J.D. Martinez grounded into a fielder's choice, and Brett Wallace then hit a tying RBI single. After another fielder's choice, Brandon Barnes singled in Wallace to give Houston the lead for good.
The Astros threatened again in the fifth, putting two runners on with two out, but Lynn retired Martinez to end the inning. That was the first of eight straight batters retired by Lynn
NOTES: Molina played first base for the second time in his career and the first since 2008. Manager Mike Matheny said Molina could ''probably play just about anywhere on the infield.'' He said playing him at first base is a good way to give his legs a rest. ''He's caught more innings than any other catcher,'' Matheny said. ''His body has been able to handle it so far, but it's going to be a tough task. We're not trying to set any records here, we're just reading his body and days like this are going to be able to keep one of the top bats in baseball in the lineup while not beating him up behind the plate.'' ... Both teams are off Thursday. Houston then begins a series with the Angels and St. Louis starts one at Oakland. ... The Cardinals activated RHP Fernando Salas (right shoulder) from the 15-day disabled list and optioned him to Triple-A Memphis. ... Houston RF Justin Maxwell was meeting with a specialist on Wednesday after he got a mild concussion when he banged his head on the ground while attempting to make a diving catch. Manager Bo Porter said they'll know more about when Maxwell can return after he is examined, but said there was no way he would be available on Wednesday. ... Houston RHP Ross Seaton cleared waivers and was outrighted to Double-A Corpus Christi. LHP Wade LeBlanc also cleared waivers and was outrighted to Triple-A Oklahoma City.
Link to box score: Houston 4, St. Louis 3
Link to game discussion at The Cardinal Nation message board