Houston starter Edgar Gonzalez was looking to improve to 3-0 in his short time with the Houston Astros.

Instead he was done in by a four-run first inning, and the Philadelphia Phillies were well on their way to a 12-6 win Friday night.

Jimmy Rollins hit a leadoff homer, Domonic Brown had a two-run shot and John Mayberry and Ryan Howard each had three RBIs to lead Philadelphia.

The Phillies rebounded from Thursday night's 6-4 loss to Houston, which broke a seven-game winning streak and left them four games back for the second NL wild-card spot. Friday's win cut it to 3 ½, with the Cardinals and Dodgers still playing on the West Coast.

Rollins' homer keyed the four-run first inning on a night when the Phillies came one run shy of a season high.

"The first inning I was struggling with my fastball command," Gonzalez said. "I was trying to hit the corners, but nothing you can do with that. They are good hitters and got it."

Gonzalez had won both of his starts entering Friday's game since his contract was purchased from Triple-A Oklahoma City on Sept. 3.

A two-run homer by Matt Downs got Houston within 5-3 in the fourth. Mayberry's two-run single in the fifth stretched the lead to 7-3.

Justin Maxwell added a solo shot in the fifth for the last-place Astros.

Cole Hamels (15-6) gave up four runs and seven hits over seven innings, and tied a career high for wins set in 2007. It was the first victory over the Astros for the left-hander in his last five tries, and his first win overall since Aug. 18 after not factoring into the decision in his last three outings.

"If you get four runs off Cole Hamels, then it's a big night offensively," Downs said. "It is always tough to put runs up against a guy like that, but they swung the bats extremely well tonight."

Hamels threw 95 pitches, ending a streak of 14 straight games with at least 100 pitches.

Gonzalez (2-1), starting in place of Bud Norris — scratched on Thursday because of a blister on the index finger of his throwing hand — needed 32 pitches to get through the first inning and was done after the fourth.

Four Houston relievers combined to give up eight runs in the four innings after Gonzalez's exit.

"There were some good things that happened, but unfortunately, the bullpen, it was a rough outing for most of them out there," Houston interim manager Tony DeFrancesco said. "That seems to be the story — a couple good games then a couple bad games. If we can be consistent coming out of the 'pen and shutting them down, that could keep us in the game."

Brown's homer, to the second deck in right field, made it 9-4 in the seventh.

After Rollins homered into the right-field seats for his 42nd career leadoff shot, extending his team record, Juan Pierre drew a walk, stole second base and scored on a single by Chase Utley. Utley swiped second base before making it 3-0 when he scored on a ground-rule double by Howard. Mayberry's two-out RBI single left the Phillies up 4-0.

Mayberry, who finished with three hits, doubled in the fourth and scored on a single by Kevin Frandsen to push the lead to 5-1.

Chuckie Fick walked Utley and Howard with one out in the fifth before being lifted for Fernando Rodriguez. After an intentional walk to Brown loaded the bases, Mayberry's single was deflected by Rodriguez and rolled to second baseman Jose Altuve. Utley and Carlos Ruiz scored before Altuve could get the throw to the plate and the Phillies increased the lead to 7-3.

Utley had an RBI double in the eighth and Howard drove in two runs with a single.

NOTES: Jeff Kent, who played for the Astros from 2003-04, was scheduled to throw out the first pitch on Friday as Houston continues the celebration of the 50th anniversary of the franchise. But Kent was still recovering from breaking four ribs and puncturing one of his lungs in a recent dirt bike accident, so his 9-year-old son Kaeden threw the pitch. Kent is set to appear "Survivor: Philippines," the 25th season of the show, which premieres later this month. "The opportunity came for me to challenge myself and compete and compete socially, which was a challenge in itself," he said of the show. "It was a fun experience." ... Ruiz was the only player in Philadelphia's lineup without a hit Friday.