Miami, FL (SportsNetwork.com) - NBA Sixth Man of the Year candidate Lou Williams had 29 points and the Toronto Raptors defeated the Miami Heat 107-104 on Saturday night.

DeMar DeRozan added 24 points, six rebounds and four steals for the Raptors, who have won three straight and six of their last eight games.

"I thought we met their physicality going down the stretch and that was big," Toronto coach Dwane Casey said.

Toronto, which has clinched home-court advantage in the first round of the playoffs, is tied with Chicago for the Eastern Conference's third seed.

Dwyane Wade posted 30 points, six rebounds and five assists for Miami, which has dropped six of its last seven contests. Hassan Whiteside supplied 16 points, 18 boards and six blocks and Goran Dragic provided 22 points and five helpers.

The Heat are 2 1/2 games behind Boston and Brooklyn for the final two playoff spots in the East. Miami has just two games remaining, while the Celtics and Nets each have three left.

"This is not a place I'm used to being at all," Wade said.

The game was tied 94-94 after Wade sunk a pair of foul shots with 2:55 left, but the Raptors used a 10-3 run to go in front for good.

Williams knocked down a left elbow jumper and DeRozan drove the left baseline before getting his layup to crawl over the front of the rim while drawing a foul on Wade for a three-point play.

Wade then hit two free throws and Luol Deng split a pair to get the Heat back within 99-97 with 51.7 ticks on the clock, but Williams' straightaway 3- pointer at the other end was the dagger.

Two Kyle Lowry free throws capped the surge with 21.4 seconds left for a 104-97 margin.

Earlier, neither team led by more than six in a closely contested first half. The Heat were up 29-27 following a quarter of play, but the Raptors outscored them 31-29 in the second and the game was tied 58-58 at the break.

A Dragic triple and three-point play finished off a 9-2 Miami spurt midway through the third, staking the Heat to a 75-68 cushion.

Toronto battled back to get within 81-79 after three and ripped off 11 straight points during the early stages of the fourth to build a six-point gap. A Charles Hayes tip-in concluded the swing for a 90-84 Toronto lead.

Miami, though, responded by scoring eight of the next 10 points to tie it, with a Whiteside tip-in knotting things at 92-92 with 4:47 to play.

Game Notes

Toronto snapped a 10-game losing streak in Miami, last winning in South Beach on Nov. 19, 2008 ... Chris Andersen nailed his fourth 3-pointer of the season. He had recorded four from long distance in his career coming into the year ... Miami was just 24-of-44 from the foul line.