Artemi Panarin and Kaapo Kakko scored for the Rangers (47-22-13), and Jaroslav Halak made 18 saves. New York had a six-game point streak end (3-0-3).
"I think we've established a clearer idea of how we want to play and how we should play," Rangers center Mika Zibanejad said. "I think the resilience in this group in this locker room has been there over the past two years. I don't think there's been anything new. There's different challenges this year, but we'll try to summarize and close this regular season, take a day and then focus on the playoffs."
Kakko gave New York a 1-0 lead at 1:38 of the first period, scoring with a backhanded shot from the right face-off circle off a pass from Vincent Trocheck after a Toronto giveaway in the defensive zone.
Liljegren tied it 1-1 at 3:09 of the third period from a step inside the right circle, closest to the wall, that hit off Niko Mikkola's stick blade and fluttered through Halak's five-hole.
The Rangers appeared to take a 2-1 lead with a goal from Braden Schneider at 5:52, but the Maple Leafs used a coach's challenge for offside. Video review determined that Trocheck entered the zone illegally 22 seconds earlier, negating the goal.
New York went ahead 2-1 at 6:26, when Panarin scored a power-play goal on a one-timer from the left circle off a spin-o-rama pass from Adam Fox.
The lead lasted 1:22 before Nylander scored from in front of the net off a pass from Ryan O'Reilly to tie it 2-2 at 7:48. It was his sixth and last shot on goal of the game. He had 12 shot attempts.
"I was shooting it maybe a little bit more than usual today to get that 40th goal," Nylander said. "It's nice it came out in the end."