Hamels (5-2) struck out eight and walked only one, helping carry the two-time defending National League champions to their sixth win in eight games.
J.C. Romero recorded the final two outs to pick up his second save.
Werth hit his homer in the fifth and Howard singled in another run in the sixth.
The lone Boston score came on a first-inning homer from Victor Martinez. John Lackey (4-3) gave up six hits and four runs in five innings to take the loss. The Red Sox had won their previous three games.
Celebrity Couples of 2014 [PHOTOS]