Hamels (6-13) gave up two runs on nine hits to remain unbeaten in six August starts. This, however, was only his second win of the month.
The Philadelphia starter helped his own cause with a base hit in the fifth that brought home Michael Young and Cody Asche to give the Phillies a 4-1 lead.
Carlos Ruiz hit a solo homer for Philadelphia in the sixth.
Daisuke Matsuzaka made his second start since joining the Mets and he has lost them both. He gave up four runs on six hits in 4 1/3 innings.
2014: NFL Cheerleaders [PHOTOS]
LeBron James reveals his new Nike shoes