Updated

Miami, FL (SportsNetwork.com) - LeBron James netted 30 points and put the game away at the foul line as the Miami Heat edged the surging Toronto Raptors, 102-97, from American Airlines Arena.

James' midrange jumper gave Miami a 92-86 lead with 4:47 to play, but Toronto kept it close with an Amir Johnson three-point play and Jonas Valanciunas layup.

It was 96-95 after DeMar DeRozan's driving dunk with a minute left. James came up flat with a long jumper on the next Heat possession and Johnson had a chance to put Toronto in front, but his short hook shot with 24.9 ticks remaining rimmed off.

Dwyane Wade and James each made a pair at the line around a quick Valanciunas layup, giving Toronto one last chance to knot the contest. Kyle Lowry dribbled on the right wing and created space with a stepback, but missed a 3-pointer over Norris Cole. James grabbed the rebound and hit two more free throws to seal it.

Michael Beasley scored 17 points off the bench for the Heat, winners in four of five, while Wade added 14 and nine rebounds as he played in the second tilt of a back-to-back for the first time since Nov. 16.

The loss snapped Toronto's season-long five-game winning streak.

DeRozan had 26 and seven assists for the Raptors. Lowry went for 14 with nine helpers while Valanciunas and Johnson totaled 17 points apiece.

Miami led 52-51 after an up-and-down first half that featured seven ties and 10 lead changes.

Lowry canned a pair of 3-pointers during an 18-7 Toronto charge early in the third. Miami came storming back to tie it, but Lowry's turnaround jumper at the horn made it 84-79 heading into the final frame.

"The first half, there were some stretches we weren't playing hard enough defensively. They were able to shake free for some open ones," Heat coach Erik Spoelstra said. "In the third quarter, we were playing much more competitive and they were making them, which was tough. But I like that we stayed with it mentally."

Roger Mason, Jr. hit a corner 3 and Chris Andersen converted an alley-oop from Wade to tie it at 84 apiece early in the low-scoring fourth. Toronto mustered just 13 points in the period, and neither team led by more than six the rest of the way.

"They turned up the pressure. They made us put it on the floor. They put us on the free-throw line but we didn't convert. We've got to make free throws against a team like this," said Raptors coach Dwane Casey.

Game Notes

Mario Chalmers did not play in the second half with tendonitis in his right Achilles ... Miami outrebounded Toronto 42-34 ... Chris Bosh scored just eight points, matching a season-low with two field goals ... The Heat made 23-of-27 foul shots, while Toronto hit just 12-of-21.