The Phillies can tie Milwaukee for the top spot by sweeping a day-night doubleheader on Sunday.
Philadelphia also trails the NL East-leading Mets by two games, pending the outcome of New York's nightcap against Atlanta. The Braves won the opener of a doubleheader 3-2.
Hamels (13-9) allowed two runs and six hits, rebounding from a poor outing at Shea Stadium last Sunday. Hamels had a chance to put the Phillies in a tie with the Mets, but gave up five runs in a 6-3 loss.
This time, the left-hander delivered.
"I'm more antsy after two bad starts," Hamels said. "One bad start doesn't affect my morale."
Struggling Milwaukee has lost nine of 12, including two straight in Philly. The Brewers are trying to avoid another late-season collapse. They built an 8½-game lead in the NL Central by late June last year only to finish two games behind the Chicago Cubs.
"Tomorrow is big. Nothing really matters except winning," Brewers slugger Prince Fielder said. "This is the way I like it. There's no pressure. Just go out there and play. This is when it's fun."
Brewers starter Manny Parra (10-8) didn't make it out of the second inning. The left-hander gave up five runs and seven hits in 1 1/3 innings. He's 2-6 since the All-Star break.
"He hasn't pitched well," manager Ned Yost said. "He pitches in spurts and doesn't contain the damage. It's been a struggle for him."
Rollins sparked Philadelphia's inconsistent offense with leadoff hits in the first and second. He finished 3-for-5, falling a triple short of the cycle, with two RBI and three runs.
Rollins doubled in the second and went to third on Utley's infield single that appeared to bounce off his foot before rolling fair. After Werth walked, Ryan Howard hit a two-run single to center for a 5-0 lead. Howard leads the majors with 131 RBI.
"Jimmy's the catalyst. When he goes, we go," Howard said.
Hamels got more runs in the first two innings than in any of his losses this season. The Phillies have averaged 2.1 runs in Hamels' nine losses, including 1-0, 2-0 and 3-0 defeats.
"It's all about the team and the win, especially now," Hamels said.
Milwaukee sliced the deficit to 5-2 with a pair of gift-wrapped runs in the fifth. With two on and two outs, Jason Kendall lofted a fly ball to left field that was misjudged by Pat Burrell. The ball landed beyond Burrell's reach for a two-run double.
The usually cucumber-cool Hamels reacted in disgust to Burrell's gaffe, but retired pinch-hitter Angel Salome to end the inning.
Rollins hit his 11th homer, a two-run shot, off Carlos Villanueva in the sixth.
"I saw some good signs offensively," Yost said.
- Brewers hitting coach Jim Skaalen was ejected in the fourth for arguing that a pitch hit Fielder instead of his bat.
- A crowd of 45,105 was the 46th sellout at Citizens Bank Park this year.
- Hamels leads the NL in innings pitched (214 1/3).