The Flyers lost their second straight and failed to expand their one-point lead over idle Washington at the top of the Eastern Conference. Both teams have four games remaining.
Philadelphia had a 1-0 advantage after one period, but Elias tied it 6:28 into the second and put the Devils in front less than 2 minutes later with a shorthanded goal.
The Flyers moved back into a tie 4:18 into the third on a goal by Jeff Carter, but Nick Palmieri restored the New Jersey lead midway through the stanza and Elias added an insurance goal with 2:46 remaining in regulation.
Johan Hedberg made 34 saves for the Devils, who would have been eliminated from playoff contention if they had lost to the Flyers. New Jersey will likely miss the playoffs for the first time in 15 seasons.
Brian Boucher gave up all four New Jersey goals on 24 shots.