The Heat held only a two-point advantage at halftime before limiting the Raptors to just 23 points during the final two quarters.
James sat out the fourth quarter and finished with five rebounds and four assists. Mike Miller added 13 points off the bench for Miami, which has won four in a row.
Toronto was led by 18 points from James Johnson and 15 from Alan Anderson. The Raptors have dropped six out of eight.
Miami stayed within 2 1/2 games of Chicago for the No. 1 seed in the Eastern Conference.
Toddler uninjured after being knocked over by Obama family dog
Exploding whale video goes viral on Internet