HOUSTON (AP) -- With one swing of the bat from Jimmy Rollins on Friday night, the Philadelphia Phillies put a tough loss to the Houston Astros a night before behind them.
Rollins hit a leadoff homer, Domonic Brown had a two-run shot and John Mayberry and Ryan Howard each had three RBIs as the Phillies beat the Astros 12-6.
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 1/2, with the Cardinals and Dodgers still playing on the West Coast.
''It's huge,'' Philadelphia starter Cole Hamels said of Rollins' homer. ''That's something that Jimmy's done a lot in his career, and when he's able to do that, it really kind of puts the edge into our favor and really gets guys fired up to go out and perform at the highest level. With what we have at stake going on right now, that's what we need.''
Rollins' homer keyed a four-run first inning on a night when the Phillies came one run shy of a season high.
''We don't have too many where we can kind of relax,'' Phillies manager Charlie Manuel said. ''At the same time, tonight, that was good for us. Getting some hits and scoring some runs was good for us.''
Rollins downplayed the importance of his homer, but did acknowledge that it started the night on a high note.
''That was probably a good thing,'' he said. ''Even better, we didn't stop there. This team plays us tough. Always have, don't know why. Whether they're a team well over .500 or a team well under .500, we show up and we have a problem with them.''
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.
Hamels (15-6) gave up four runs and seven hits while fanning eight 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.
He liked having a big lead before stepping on the mound.
''Just being able to come out and put up the runs early is huge, just because you want to just get the momentum back,'' Hamels said. ''Especially after last night, you want to get things rolling again and get the positive mojo going so we can get back into how we know we've been playing baseball for the last week.''
Edgar 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.
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.