ST. LOUIS — Matt Carpenter hit a two-run home run and Matt Holliday drove in two with a two-out hit to help the St. Louis Cardinals beat the Houston Astros 5-4 on Wednesday night.

Carpenter's ninth homer of the season in the seventh gave the win to Seth Maness (5-1). Tony Cruz got hit by starter Jordan Lyles' first pitch of the inning and one out later Carpenter put a 2-1 pitch into the right field stands off reliever Wesley Wright (0-3).

Maness gave up two hits and a run in two innings of relief. He struck out three.

Edward Mujica earned his 25th save in 26 tries. He has appeared in six consecutive games, going 1-1 with four saves.

Lyles gave up four runs and six hits in 6 1-3 innings. He struck out two and walked two. Lyles hasn't won a game since beating Milwaukee on June 18.

Shelby Miller used 94 pitches to labor through five innings. He gave up three earned runs, walked five and struck out five. He had a total of six full counts, coming back to strike out Jason Castro and getting Brett Wallace to ground out.

Wallace, who had four hits and scored a run, drove in Jose Altuve in the seventh to give Houston a 4-3 lead. His only out was a grounder in the fifth that led to Houston's third run.

Holliday's single in the fifth tied the score at 3-3. His slap to right field drove in Cruz and Shane Robinson, who had a pinch hit single in place of Miller.

Allen Craig walked to open the second and scored on Matt Adams' single. Adams has five RBIs in in his past six games.

After going in order to start the game, the Astros put their leadoff batter on and had a runner reach scoring position in three of the next four innings against Miller.

Chris Carter hit his 18th home run just over the right field fence to open the second. Houston then used a Wallace single, two walks and an error for a 2-0 lead. It took a 3-1 lead after Jason Castro hit a ground rule double and J.D. Martinez drove him in with a single in the fifth.

NOTES: Cardinals C Cruz got his third start in the past four games in place of All-Star catcher and league-leading batter Yadier Molina who is nursing a sore right knee. He's gone 3 of 9 in that span. ... Molina struck out as a pinch hitter in the seventh. ... Wallace, former first-round pick of the Cardinals, is 7 for 18 with five RBIs and four runs in four games this season against St. Louis. ... Jake Westbrook will start the Cardinals' first game after the All-Star break, July 19 against the visiting Padres, manager Mike Matheny said. Westbrook will be followed by Lance Lynn and Adam Wainwright. Following an off day on July 22, Miller will start against the Phillies in St. Louis. Because of the off day, the Cardinals do not plan to use Joe Kelly until July 27. ... Astros manager Bo Porter said before the game he had not yet finalized his team's rotation plans for its series at Tampa Bay this weekend. ... The Astros have lost 13 of their past 15 games against their former NL Central division rivals.