TORONTO -- Dwane Casey wasn't in the mood to celebrate his team's victory Tuesday night.

DeMar DeRozan scored 27 points as the Toronto Raptors defeated Miami 115-112. But the Heat made things difficult, rallying from a 17-point deficit and coming within two points at 114-112 with 6.6 seconds remaining.

"We had a comfortable 15-point lead, and then we got comfortable," Casey said. "We stopped executing, stopped moving, stopped cutting, stopped being strong with the ball."

Kyle Lowry recorded 22 points and eight assists for the Raptors (40-16), who increased their lead over Boston to one game for the top spot in the Eastern Conference.

Goran Dragic led the way for the Heat (30-27) with 28 points, including 16 points in the third quarter.

Dwyane Wade picked up a double-double with 10 points and 11 assists off the bench. It was his third game since returning to the club in a trade with the Cleveland Cavaliers on Feb. 8. Hassan Whiteside also had a double-double with 10 points and 10 assists.

The Raptors hold the best home record in the league (24-4), and won their sixth consecutive game, matching a season high.

Even so, Casey wasn't thrilled with Tuesday's effort.

"I'm upset, even though we won because I know, I know what's coming around the corner," Casey said. "Like you're going down a dark alley, here comes a group of guys with a baseball bat and you say, 'oh, hey, where's the baseball game?' It's 12 o'clock at night, you know what's coming around the corner."

The Raptors led 28-24 after one quarter, but neither team was able to generate much of a scoring run.

The close battle continued in the second quarter before the Heat erased the deficit with a 13-3 run and led by eight points with 3:56 to go in the half.

Toronto responded with a 10-2 run of its own to erase Miami's lead. The Raptors led 57-55 at halftime.

Toronto opened up its lead in the third quarter. With the game tied 77-77, the Raptors went on 21-4 run and ended the frame with a 98-81 lead.

"We had a bad three or four minutes there where we had some turnovers," Wade said of Toronto's third-quarter surge. "This is a great fast-breaking team, and if you give them opportunities, they'll tear it up."

Toronto finished with 22 fast break points compared to 12 from Miami.

The Heat outplayed the Raptors in the final quarter, outscoring Toronto 31-17. With Toronto leading 112-98 with 4:20 remaining in the game, Miami pushed the Raptors with a 16-3 run.

"I think we were displeased, but that's a hard-playing team," Lowry said. "We could have closed out better, but we've got to fix it and continue to get better."

The Heat picked up their sixth loss in their last seven games and hold a 3.5 game lead over Detroit for the final playoff spot in the Eastern Conference.

Miami has given Toronto trouble this season. The Heat pulled off a 90-89 victory earlier in the year, a rare Raptors home loss.

"They can go extremely small, and they are very athletic," DeRozan said of the Heat. "They showed it tonight, and every time we play them, they shot it."