Avery got a game-tying goal 1:53 into the second period and then put the Rangers up by two with 5:55 left in the third when his wrist shot from the left boards beat Flyers goalie Michael Leighton.
Michal Rozsival scored the other New York goal while Erik Christensen and Chris Drury each notched pair of assists as New York won a second straight game to pull to within a point of idle Boston for the last Eastern Conference playoff spot.
Henrik Lundqvist stopped 17 of 18 shots to record a win in his 28th game of the season.
Philadelphia got its only goal from Danny Briere.
Celebrity Families of 2014 [PHOTOS]