Auston Matthews, Kasperi Kapanen, Zach Hyman and Justin Holl also scored for Toronto, who came back from a 3-1 deficit. Frederik Andersen stopped 24 shots in his sixth straight start.
Mike Hoffman, Noel Acciari and Mark Pysyk scored for the Panthers, while Sergei Bobrovsky made 24 saves.
With the score tied at 3, Nylander put the Maple Leafs ahead when he grabbed a loose puck in front and put it past Bobrovsky with 11 minutes left in the third.
"(Kyle) Clifford was battling there in front and it just ended up on my stick," Nylander said. "I turned and just threw it at the net. Luckily it went in, but we’ll take it."
Holl’s empty-net goal with 20.8 seconds remaining stretched the lead to 5-3.
Toronto has won three of their past four games. The Panthers have lost three of four. The Maple Leafs are four points ahead of the Panthers for third place in the Atlantic Division.
"It was a disappointing game," Panthers coach Joel Quenneville said. "At home, you have to find a way to get something out of this game."
The Panthers play their next four games at home and hope to gain some ground in their playoff push.
"One game at a time," Quenneville said. "Let’s recapture some confidence here at home and get two points and go from there. There’s lots of hockey left."
The Maple Leafs return home for a game against Vancouver, then go on a three-game West Coast swing.
"We did our part here in terms of getting off the mats and we want to build on this. We’re excited to get back home," coach Sheldon Keefe said.
Each team scored three goals in a wild first period.
Trailing 3-1, the Maple Leafs closed to 3-2 when Kapinen’s shot from the left circle beat Bobrovsky with 2:17 left in the first. Matthews tied it when he poked in a rebound with 1:02 left.
"When we got down early in the first, we just tried to keep our composure." Matthews said. "Go out there and take it one shift at a time and claw our way back."
With the score tied at 1, Hoffman put the Panthers ahead 2-1 when he found a rebound in front and shot it into the open net at 7:25. Acciari’s shot from the right circle hit the post on the far side and went in at 12:36 and made it 3-1.
The Panthers took a 1-0 lead when Pysyk one-timed a pass from Aaron Ekblad from the right circle 2:23 in.
The Maple Leafs answered 1:09 later after Hyman poked a rebound past Bobrovsky to tie it at 1.
"It was a big game for us and unfortunately we are on the wrong side," Bobrovsky said.
NOTES: Maple Leafs C Denis Malgin, acquired from the Panthers on Feb. 19, was a healthy scratch. … Toronto D Jake Muzzin will miss four weeks with a broken hand sustained in a 4-3 win at Tampa Bay on Thursday. … Florida’s Joel Quenneville became the 2nd NHL head coach to reach 1,700 games. Scotty Bowman coached 2,499 NHL games. … Ekblad’s assist on Pysyk’s goal gave him a career-high 39 points. … Panthers F Erik Haula played his 400th NHL game.
Maple Leafs: host Vancouver on Saturday.
Panthers: host Chicago on Saturday.