Updated

Josh Collmenter got off to a rough start, and the Arizona Diamondbacks couldn't quite overcome it.

The Houston Astros scored all their runs in the first two innings in a 4-3 victory over the Diamondbacks on Monday night.

"I wasn't very good the first few innings," Collmenter said. "I didn't settle down for a while. I couldn't find a rhythm."

The Astros' victory featured an unusual move by manager Bo Porter.

With his bullpen worn down, Porter took Tony Sipp off the mound and sent him to right field while right-hander Jerome Williams faced Paul Goldschmidt. Goldschmidt walked, then Sipp went back to pitching, striking out left-handed hitting Miguel Montero.

Porter had told Sipp to be ready for the switch.

"I didn't think it actually was going to happen," Sipp said. "He gave me a warning but I'm like 'All right, OK, Bo.'"

Sipp, a former Diamondback, hadn't played in the outfield since his days at Clemson.

"I think I had more focus in right field than I did on the mound," he said.

Sipp left for good and Kyle Farnsworth fanned Martin Prado to end the inning.

"It was a good play unless Goldy hit one to him," Arizona manager Kirk Gibson said. "I have seen it done before. I think I saw Lou Piniella do it in the playoffs once before. It is certainly in the rules. He's going to manage his team the way he wants to manage it. It worked out for him."

Jose Altuve had three hits, including an RBI double, and Jarred Cosart pitched six solid innings for the Astros.

Cosart (5-5) allowed three runs and five hits with two walks. The 23-year-old right-hander struck out eight, matching his career high set in his previous start against the Los Angeles Angels. He retired the first 10 batters, five by strikeout.

Goldschmidt doubled in a run for the Diamondbacks, who had won five of six going into the game.

Chad Qualls pitched a scoreless ninth for his eighth save in nine opportunities and seventh straight since May 11.

The Astros have won four of five and 12 of their last 16.

Altuve singled and scored in the first, doubled in a run in the second and singled in the fourth. Dexter Fowler had three hits, including a double, and scored twice.

Collmenter (4-3) went seven innings, giving up four runs, three earned, and seven hits.

"Colly did a heck of a job, all things considered with our bullpen the way it was," Gibson said. "For him to give us seven innings and 100 pitches in that situation, the way he started, was excellent."

Right fielder Gerardo Parra threw out Altuve trying to score from second on Jon Singleton's single in the ninth. Porter challenged, arguing that Montero, the catcher, missed the tag, but the call was upheld after a 38-second video review.

Fowler and Altuve opened the game with singles, then after an out, Jason Castro was hit by a pitch to load the bases. Matt Dominguez's sacrifice fly brought one run home. Another scored on second baseman Aaron Hill's fielding error.

In the second, Fowler singled and scored from first on Altuve's double over the head of Ender Inciarte in center field. Castro doubled Altuve home and Houston led 4-0.

Parra was the first Arizona player to reach base, drawing a walk with one out in the fourth. Goldschmidt followed with Arizona's first hit, a double down the left field line that scored Parra from first. Montero singled to put runners at first and third, but Prado grounded into a double play to end the inning.

Arizona got two more runs in the sixth.

Didi Gregorius singled, then scored from third when Parra singled and Fowler muffed the ball in center field. Goldschmidt walked, then Montero's RBI single made it 4-3.

Inciarte saved a run with a diving catch of Jonathan Villar's fly ball to end the eighth.

NOTES: Altuve stole his 24th base. ... Arizona's David Peralta was 0 for 4 with three strikeouts. He had a base hit in all seven of his previous major league games. ... On Tuesday, the Astros send RHP Brad Peacock (2-4, 4.82 ERA) to the mound against RHP Bronson Arroyo (5-4, 4.50). ... Houston OF George Springer was a late scratch with a sore right knee.