Trailing 4-1 entering the seventh, the Mets cut the deficit to two runs on a Kirk Nieuwenhuis single. They got two more when David Wright singled home Andres Torres and Nieuwenhuis scored when Phillies second baseman Pete Orr threw wildly to third base.
Wright went to third on the play and then scored the go-ahead run on Duda's hit, as the Mets went on to clinch their three-game set in Philadelphia with their fourth straight victory.
Jon Rauch tossed a scoreless bottom of the ninth for his first save of the season.
Chad Qualls (1-1) was saddled with the loss after blowing the Phillies' lead.
Hunter Pence socked a two-run homer for Philadelphia, which lost for the fifth time in seven games.
Swim Week Miami Beach 2014 [PHOTOS]