01/17/2018 18:30 EST | Updated 01/18/2018 07:45 EST

C.J. Miles leads Toronto Raptors to 96-91 home win over Detroit Pistons

TORONTO — Dwane Casey wasn't giving the Toronto Raptors any style points Wednesday night.

C.J. Miles had 21 points as Toronto pulled away for a 96-91 home win over the Detroit Pistons despite committing 21 turnovers.

"It was the ugly way," Casey said. "That team is a very aggressive team.

"They were doing something a little bit different defensively that kind of threw our rhythm off a little bit with their traps. Hats off to them because they really got after us and then we made things hard on ourselves."

Casey said Toronto did a good job in the first quarter moving the ball around before Detroit could establish its traps. The Raptors were rewarded by taking a 31-18 advantage into the second.

"I thought that stretch where we built a big lead we did do that, we did move the ball," he said. "The ball was humming, zipping, we were passing before the traps got there.

"And then as the game went on we allowed the traps to get to us before we got rid of it. We made it complicated on ourselves but again we've got to give Detroit credit."

Kyle Lowry added 18 points for the Raptors, who led by as many as 15 points in the contest. DeMar DeRozan and Jonas Valanciunas both had 17 points apiece as Toronto (30-13) outscored Detroit 23-18 in the final quarter to secure its first win in three games and third straight over the Pistons.

Andre Drummond had 25 points for Detroit (22-21), which has lost three straight and four of its last five games.

"I'd say in the last three quarters we fought hard but the first quarter counts," said Pistons coach Stan Van Gundy. "There's just not very many times where we play a good defensive first quarter.

"It's disappointing, you're working out of this hole and then late in the game you have a chance and we're not up on two pick and rolls late and Lowry and Miles hit back-to-back threes . . . when it was winning time we didn't do our job."

Three-pointers from Miles and Lowry gave Toronto a 90-83 advantage with 4:47 to play before Valanciunas's two free throws boosted the lead to 92-83 with 2:23 remaining. Avery Bradley's three-pointer pulled Detroit to within 92-86 with 1:48 left before DeRozan countered with less than a minute to play to give the Raptors a 94-88 lead.

Detroit pulled to within 94-91 on another Bradley three-pointer but Delon Wright's two free throws with 5.9 seconds remaining gave Toronto its winning margin.

On a night where both DeRozan and Lowry were a bit off, Miles was there to pick off the offensive slack. He was 7-of-16 from the field and 5-of-12 from three-point range.

"He really spaces the floor," Casey said. "He allows you if teams are double-teaming to pick them apart.

"We took advantage of that a few times . . . we did a good job of finding him and he did a good job of knocking them down."

Added Lowry: "It makes the defence not want to leave him. When he gets it going like that you just kind of know they aren't going to leave him as much."

DeRozan said it was important for Toronto to prevent losing three straight for the first time this season.

"We don't even want to lose two games in a row," he said. "This was one of those games where it could've made it three.

"We had to buckle down and understand we got to protecting our home court and not lose multiple games in a row."

Drummond's free throw with 20 seconds left pulled Detroit into a 73-73 tie at the end of the third. The Pistons outscored Toronto 22-19 in the quarter to create the tie after Jakob Poeltl's dunk with 32 seconds remaining gave the Raptors a 73-72 advantage.

Bradley's driving layup with 19 seconds remaining capped a 16-7 Detroit run that cut Toronto's half-time lead to 54-51. The Pistons made 14-of-25 shots to outscore the Raptors 33-23 in the quarter as Bradley finished the half with a team-high 11 points.

DeRozan had 10 points in the opening quarter to help stake Toronto to its 13-point lead following the first. Detroit shot 30 per cent (6 of 20) from the field and was outrebounded 17-10 as the Raptors made 11-of-26 shots (42.3 per cent) and led by as much as 15 points in the quarter.