It was the first homestand sweep of the season for the Cardinals, who are again owners of baseball's best record.
"This was a huge five-game stretch for us to come out here and win all these games and get on a little roll right before the All-Star break," Carpenter said. "Hopefully we can continue it in Chicago."
Carpenter was the first batter to face anyone other than Astros starter Jordan Lyles, who left with a lead after striking out pinch-hitter Yadier Molina for the first out of the seventh. Houston manager Bo Porter said afterward that he had laid out his pitching intentions before the inning started.
When the order turned over, he would hand the game to Wright.
"That was a totally left-on-left decision," Porter said. "I sent [Lyles] back out there with the notion that he was going to face [Tony] Cruz, he was going to face the pinch-hitter, and that Wesley was going to be ready for Carpenter."
Carpenter spoiled Houston's desired result.
With Cruz on first after being hit by a pitch, Carpenter lifted Wright's 2-1 fastball over the right-field wall. It was Carpenter's ninth homer of the year, his fourth off a lefty. Of his 15 career home runs, southpaws served up nine. Carpenter entered the game batting .287 against left-handers, compared to a .336 mark against righties.
"I think he takes it personal that they come thinking that that's something that he would have more of a weakness with," manager Mike Matheny said. "There are just some guys who are highly motivated, and I think that's one of the things that he takes a lot of pride in, taking tough at-bats so they don't just fire in left-handers against us."
The home run elicited a curtain call for Carpenter, who was recently named a first-time All-Star, and gave the Cardinals their first lead of the night.
"I take a lot of pride in those situations, being a tough out, and obviously, the other team is thinking that they're bringing in a left-hander to get you out," Carpenter said. "My goal in that situation is to do whatever I can to not make that happen."
A game that started with Shelby Miller laboring through five innings ended with a pick-me-up from the 'pen. Though Seth Maness allowed the Astros to inch ahead, 4-3, on a seventh-inning run, he notched consecutive strikeouts to strand runners on the corners.
A strikeout helped Trevor Rosenthal escape the same jam in the eighth. And despite pitching in each of the team's last five games -- covering a span of six days -- Edward Mujica was called upon in the ninth. During a pregame meeting in Matheny's office, Mujica told his manager that he felt good enough to pitch again.
A one-out single put the potential tying run on base against Mujica, who then induced a groundball. Daniel Descalso, playing third as part of a double-switch, fumbled it, foiling the chances at an inning-ending double play. That prompted Matheny to make a mound visit.
"We wanted to give him a breather," Matheny said, "and get our defense refocused on the fact that we're going to turn a double play for him."
They did on the next batter, sealing Mujica's 25th save.
"I thought I was going to feel worse, but I felt pretty good," Mujica said. "We'll see about tomorrow."
The Cardinals will likely make Mujica off-limits in Thursday's series opener against Chicago. Said Matheny: "We have a lot of talking to do."
Miller, who didn't factor in the decision, battled for five innings. He never established fastball command, which negated the effectiveness of any of his secondary pitches. The rookie right-hander walked a career-high five batters, which contributed to his elevated pitch count. Houston worked the count full seven times against Miller.
"It was a rough one," Miller said. "I didn't have anything going for me. I couldn't throw strikes with much of anything. I tried to keep the team in it with what I had, which wasn't much."
The Astros scored twice off Miller in the second, which started with Chris Carter's first-pitch homer. Another run touched home in the fifth, when Jason Castro doubled and scored on J.D. Martinez's two-out single.
That left the Cardinals trailing, 3-1.
"He never really had a feel for anything," Matheny said. "I think that's a great compliment, the fact that you see him keep us in the game. That could have been extremely ugly with the stuff he had tonight."
The Cardinals' offense bailed Miller out in the fifth, when Matt Holliday delivered a game-tying, two-run single with the bases loaded and two out. That was one of six hits Lyles scattered in 6 1/3 innings. The first was recorded by Matt Adams, who drove home Allen Craig for the team's second-inning run.
The game-tying rally closed the books on Miller's first half of the season. Miller, who will take 12 days off before his next start, went 9-6 with a 2.92 ERA in 18 starts. Efficiency continues to nag at him, though not enough to prompt the Cardinals to make any wholesale changes with how the rookie utilizes his repertoire.
"I have a little time to settle down, work on some things and get back in my groove and come out strong in the second half," Miller said. "I know that if I pitch decent and if I have average starts, these guys are going to put up runs and we're going to get wins."