Updated

St. Louis starter Lance Lynn wanted to show the Houston Astros a different look in the fourth inning on Wednesday night.

It didn't go at all the way he had planned.

Lynn walked two consecutive batters to force home the first of Houston's four runs in the fourth, and the Astros held on for a 4-3 win over the Cardinals.

"It wasn't a good inning," he said. "The hits weren't the problem — it was the walks. When you walk people, you get yourself in trouble, and that's what happened. I just didn't throw strikes."

Lynn (10-2) allowed five hits, walked four and struck out four over 7 2-3 innings for his first loss in four career starts in Houston.

Erik Bedard pitched six effective innings for the last-place Astros, who had dropped three of four.

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.

Molina and Craig helped the Cardinals get off to a nice start. Molina followed Carpenter's leadoff single in the first 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.

"He just kind of lost his rhythm," Cardinals manager Mike Matheny said of Lynn. "It looked like he was coming across the ball a little bit and fighting to find his timing. We've done that to a number of teams lately, where we let one inning really hurt, and it got the best of us."

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.

Veras yielded a one-out single to Jon Jay and then walked Matt Adams, but pinch hitter Daniel Descalso struck out and Matt Carpenter flied out to end the game.

"They battled and kept fighting as always, but it was just too little, too late," Matheny said. "We want to see the fight, but we'd rather see the win. We looked like we might have something going there, but that's what closers do. They come in, they stop it."

The Astros also threatened 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, who began the day with a 3-0 record and a 2.00 ERA in three games in Houston.

Josh Fields retired the first two St. Louis batters in the seventh before left-hander Wesley Wright struck out Carpenter.

Jose Cisnero faced the heart of the Cardinals' order in the eighth. He got Molina on a groundout before walking Carlos Beltran. He then struck out Craig and Matt Holliday to finish the inning.

NOTES: Molina played first base for the second time in his career and the first since 2008. 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.