Updated

Houston manager Bo Porter knows that many question why he keeps penciling Chris Carter into the lineup game after game when the designated hitter is batting below .200.

Carter illustrated perfectly Wednesday night why Porter sticks with him.

Carter homered twice, Dallas Keuchel pitched eight strong innings and the Astros beat the Arizona Diamondbacks 5-1.

Carter's first solo home run made it 3-1 in the fourth inning, and he added an opposite-field shot in the seventh. It was the fifth career multihomer game for Carter and second this year.

The slugger has struggled this season and is batting just .199, but his power is undeniable and he's tied for the team lead with 12 homers.

"He's been up and down this year," Porter said. "The power numbers are there. The batting average is not there, but at the same time he's had some big hits and tonight is a step in a huge direction to him getting going."

Carter led the Astros with 29 homers and 82 RBIs last year in his first full season in the majors. He feels less pressure at the plate now that the lineup has been beefed up with the addition of rookies Jon Singleton and George Springer.

"It's nice to have guys like that where you don't feel like you're the only guy in the lineup where you have to do everything or everyone is looking to you to get a home run or something," Carter said.

Keuchel (8-3) won for the sixth time in seven starts. He allowed four hits and a run, striking out five and lowering his ERA to 2.38. Even though the game is more than a month away, Porter was already stumping for Keuchel to get the All-Star call.

"You look at the season Dallas Keuchel has put together to this point and if he's not an All-Star, what is? He continues to impress," Porter said. "It's a joy to watch."

Brandon McCarthy (1-9) allowed eight hits and four runs in six-plus innings to remain winless since May 3.

"I wasn't sharp from the get-go, but I thought I did a good job to get as deep as I could," McCarthy said. "The seventh inning there. The home run hurts and the guys getting on after that hurts and kind of spoils everything."

Aaron Hill homered in the fourth for Arizona's only extra-base hit.

Springer had two hits and an RBI and Singleton drove in a run as the Astros won for the fifth time in seven games.

McCarthy has had success in Houston in the past and entered the game 2-0 with a 0.60 ERA in his career at Minute Maid Park.

But the Astros got going against him early, with Springer singling in the first, Singleton drawing a walk and Jason Castro grounding an RBI single. Singleton was thrown out at third on the play.

Jonathan Villar singled to start Houston's third before a one-out single by Springer. Both players advanced on a wild pitch by McCarthy before Villar scored on a groundout by Singleton to make it 2-0.

The Diamondbacks didn't get a hit until Hill led off the fourth with his homer to the Crawford Boxes in left field to cut the lead to 2-1.

Paul Goldschmidt singled after Hill's homer, but Keuchel got back on track after that and retired 13 of his next 14 batters. The only hit in that span came on a single by Chris Owings with one out in the sixth inning.

Ender Inciarte singled with two outs in the Arizona eighth, but Keuchel retired Owings to end the inning and Keuchel's night.

Springer drove in a run with a sacrifice fly in the seventh inning.

NOTES: The series wraps up on Thursday when Arizona's Wade Miley opposes Scott Feldman. ... Houston 2B Jose Altuve missed his first game of the season because of soreness in his oblique muscle. Porter said Altuve didn't want to take the day off and tried to convince him to let him play. ... Diamondbacks OF Gerardo Parra was out of the lineup for a scheduled day off. ... The Astros signed several players taken in last week's draft. They signed second round pick 1B A.J. Reed, RHP Ryan Thompson (23rd round), RHP Vince Wheeland (24th round), LHP Zach Davis (25th round), INF Mott Hyde (26th round), RHP Brandon McNitt (27th round) and RHP Keegan Yuhl (35th round).