Hamels (4-2) held the Brewers to two runs on six hits over 6 2/3 innings, walking three and striking out three. He lined a double into the right-field gap in the second inning into stake his team to a 2-0 lead.
J.C. Romero pitched a scoreless ninth for his first save, nailing down a win that lifted the Phils to a sweep of their three-game weekend series with Milwaukee.
The victory moved the Philadelphia to 10 games above .500 (23-13) and increased its lead in the N.L. East to four games over Washington and Florida.
Placido Polanco collected two hits and an RBI and Wilson Valdez drove in a run in the win.
Casey McGehee and Corey Hart connected for back-to-back solo homers for the Brewers, who went 0-6 on their homestand and dropped their eighth straight game at Miller Park.