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.
N.J. man wakes up from 10-hour sleep with knife in back
Campus cop fatally shoots Texas student during traffic stop