Patrice Bergeron, David Pastrnak and A.J. Greer scored, and Linus Ullmark made 18 saves for Boston (33-5-4), which ended its four-game losing streak to Toronto in a matchup of the top two teams in the Atlantic Division.
"We're also aware of the standings," Bergeron said. "There are teams that are trying to catch up to us. They know it's big points for them and big points for us, so you know it's going to be a battle."
Auston Matthews scored in his return after missing two games with an undisclosed injury for Toronto (26-11-7). Michael Bunting had a goal and an assist, Mitchell Marner had two assists, and Matt Murray made 30 saves.
"We can play with any team in the League," Maple Leafs coach Sheldon Keefe said. "At the same time, you can't beat yourself when you're playing any team in the League, for that matter, but a team of this caliber [in Boston], you can't give them freebies, and we did. … You have to learn these lessons sometimes the hard way, and you like to think our group is past some of these things, but clearly not."
Matthews tied the game 3-3 at 3:17 of the third period. He roofed the puck short side after Marner forced a turnover.
"That was honestly a pretty good hockey game," Matthews said. "Two pretty good teams, it was tight the whole way through, and obviously they get one at the end there, and that's enough for them. I thought we did a lot of good things tonight. Close game, could have probably went either way."