Connor Brown and Connor Carrick also scored to help the Maple Leafs win for the seventh time in nine games (7-1-1). Toronto moved four points behind Philadelphia for the second wild card in the Eastern Conference. Tyler Bozak and Mitch Marner had two assists each.
Toronto, which came in sixth in the league on the power play at 22 percent, were 2 for 4 and held the Rangers to 0 for 6.
Both teams were playing for the first time since last Saturday. The Rangers were coming off a 5-4 win at Columbus, and the Maple Leafs lost 5-3 at home to Montreal.
Trailing 3-1 after two periods, the Rangers pressed in the third, outshooting the Maple Leafs 14-7.
With Kevin Klein off for slashing, Carrick gave the Maple Leafs a 4-1 lead with 6:40 left, knocking in the rebound of a shot by Bozak for his second of the season.
Miller pulled the Rangers within two again, scoring his 13th off a pass from Pavel Buchnevich with 1:25 remaining.
Kreider gave New York a 2-1 lead at 9:05 of the second. During a scramble in front of Toronto’s goal, Kreider was down on the ice as he tried to swipe the puck in from the right side. The attempt was stopped by Andersen, but the puck came back to Kreider, who turned and was still down on one knee as he backhanded it in for his team-leading 17th.
Brown restored the Maple Leafs’ two-goal lead as he fired a long shot from beyond the left faceoff circle that deflected in off the back end of the stick of Rangers defenseman Ryan McDonagh. It was Brown’s 10th goal and gave rookie Auston Mathews his team-leading 36th point.
Nylander got Toronto on the scoreboard 4:49 into the game, taking a pass from Nazem Kadri, skating into the right faceoff circle and firing a shot from the dot through Lundqivst’s five-hole for his ninth.
The Maple Leafs doubled their lead with 2:32 left in the opening period. With about 9 seconds remaining on a hooking penalty on the Rangers’ Brandon Pirri, van Riemsdyk got a pass from Marner in front, moved the puck to his left and sent it through the five-hole of Lundqvist down on his knees for his 15th.