Richards' tip-in shot on a pass from Kimmo Timonen was the deciding goal with 7:58 to play.
New Jersey went up 2-0 on goals by Zach Parise in the first period and Anssi Salmela in the second but the Devils could not get another shot past Flyers' goalie Michael Leighton, who ended up with 28 saves.
Van Riemsdyk and Carter wiped out the deficit with goals in a 1-minute span late in the second, setting the stage for Richards' winner in the third.
Martin Brodeur blocked 34 shots for the Devils, who have lost four of their last five games.
The teams will clash again Wednesday in Newark, N.J.