Hamels (7-7) surrendered six hits, walked three and struck out three in 7 2/3 innings of shutout ball.
Hamels was taken out of the game following Joey Votto's two-out double in the eighth. Contreras then came on to retire Jonny Gomes after walking Scott Rolen to get Philadelphia out of the jam.
Jimmy Rollins knocked in the only run. The Phillies went into the All-Star break at 47-40 after notching their first four-game sweep against the Reds since 1975.
Reds starter Matt Maloney (0-2) absorbed the loss, allowing one run on four hits.
Cincinnati (49-41) still leads the National League Central going into the break despite being swept.
Chipotle plans first price increase in 3 years
Putin thinks Obama would save him if he were drowning