The Blueshirts have a three-games-to-two series lead and can advance to the Metropolitan Division finals by beating the Flyers on Tuesday at the Wells Fargo Center.
"We've put ourselves in a good position," said Richards, who scored his second goal of the series.
The Flyers are 3-14 in series when they trail by three games to two. They are 18-2 in series when they have a 3-2 lead.
The Rangers, who had a second-period goal that was disallowed because of a quick whistle, are 13-2 in series when they have a 3-2 lead.
With goalie Steve Mason pulled for an extra attacker, Claude Giroux scored on a one-timer from the left wing with 1 minute, 29 seconds remaining, getting the Flyers to within 3-2.
But Brian Boyle iced the win by scoring an empty-net goal with 15 seconds to go.
Gill lamented his missed chance to tie the score at 1 and maybe change the game's complexion.
"I was trying to find a seam and I just mis-hit it," he said.
The Rangers then went down the choppy ice on an odd-man rush that led to Richards' goal, making it 2-0 with 11:53 left in the second.
About eight minutes later, after a bad passing exchange between Braydon Coburn and Gill, Dominic Moore took the puck from Gill, went in alone, and made it 3-0. Gill, who played just six regular-season games, was in the lineup because of an injury to Nick Grossmann.
Moore's second series score gave the Rangers three goals on just 12 shots.
"I tried to kick it up and I kicked it back," Gill said. "I have to make that play, and I didn't."
The Flyers' power play was futile on the first four chances, but the visitors got a five-on-four goal from Vinny Lecavalier - the 25th tally in his playoff career - with 33 seconds left in the second period, cutting the deficit to 3-1.
Lecavalier's shot deflected off defenseman Kevin Klein and got past Henrik Lundqvist.
Thanks to a terrific play by Martin St. Louis, the Rangers scored the first goal for the fourth time in the five series games.
St. Louis weaved through the neutral zone, crossed into the Flyers' end, and sent a drop pass to defenseman Marc Staal, whose shot from the top of the left circle appeared to deflect off the stick of Coburn and got past Mason with 8:07 left in the first period.
"It wasn't a screen when he shot it; it was at the end and it dipped quick before it got to me," Mason said. "It changed the height of the shot."
After dropping the pass, St. Louis headed toward the net and appeared to distract Mason.
The Flyers played much better than they had in the first period in Game 4, but they were tied, 1-1, after 20 minutes in that contest. They faced a 1-0 deficit heading into Sunday's second period.
"We lost the game in the first period [with] our execution in general," Flyers coach Craig Berube said. "We had some opportunities, a two-on-one. There were plays that if we executed, we would have had success."
In the first period, the Flyers got two early power plays while the game was scoreless, but they looked disorganized and generated few chances, delighting a crowd that included Jim Carrey, Susan Sarandon, and Spike Lee.
The teams have alternated wins in this series. The Rangers have lost 11 straight games after taking a series lead. If the Flyers can't make it a dozen, their season will be over Tuesday.
"We're confident," Berube said, "because we feel as a team that we can play better."
The problem is, the Rangers - who have more speed and a much better defense than their opponent - are the reason they are not playing better.
BY THE NUMBERS
Flyers' record in playoff series when they trail by three games to two.
Game-high shots on goal by Claude Giroux, who scored his first goal of the series.
Braydon Coburn's plus-minus rating for the series.