DETROIT (AP)Trey Lyles scored 21 points, Cade Cunningham and Hamidou Diallo each added 18 and the Detroit Pistons extending their surprising stretch by beating the Toronto Raptors 103-87 on Friday night.

The Pistons are 5-3 in 2022 after finishing 2021 with 18 losses in their last 19 games.

”We’re finally getting into a rhythm and figuring out the best way to play together,” Diallo said. ”We’ve got so many young guys in our locker room and they are learning that it is a long year. You can’t get too high or low after one game.”

However, they were coming off a 133-87 loss in Chicago on Tuesday.

”We’ve had more games lately where we’ve taken the opportunity to hit the other team right off the bat, and tonight shows what happens when we do that,” Lyles said. ”Obviously, we didn’t do that in Chicago, and we got embarrassed.”

Josh Jackson had 13 points off the bench as the Pistons held Toronto to 32.2% shooting. With three starters spending much of the night in foul trouble, Lyles and Jackson came off the bench to play an important role in the win.

”We are undersized every night, and tonight we had Trey at his size (6-foot-10) going against three 7-footers out there,” Pistons coach Dwane Casey said. ”So for him to get us 21 points and seven rebounds is a yeoman performance.”

Fred VanVleet had 24 points and 10 assists for Toronto, but shot 6 for 21 from the floor. Pascal Siakam added 23 points and 11 rebounds for the Raptors, who have lost two straight after winning six in a row.

”We need to be ready when we come out to play on the road, and we didn’t do that tonight,” Raptors coach Nick Nurse said. ”Our energy was low at the start and we spent the whole night trying to find it.”

Scottie Barnes finished with eight points on 4-of-13 shooting in his return from COVID-19 and knee soreness.

”Coming off the COVID break, it was tough to get my knee at 100 percent,” he said. ”I just have to be able to get back to trust my body again.”

Detroit built a 56-43 halftime lead – its largest of the season – by holding the Raptors to 28.6% shooting, including 2 for 9 for VanVleet. The Pistons also had a 22-7 edge in bench points for the half, including 15 from Lyles.

Detroit extended the lead to as many as 18, but had several key players in foul trouble. The Raptors got within 69-60, but their continued offensive struggles meant they trailed 83-66 at the end of the third.

”I thought we did a good job defensively in the first half, but we took that to another level in the third,” Jackson said. ”We know how fast the Raptors can get back into a game, so we didn’t want to give them that chance.”

Jackson started the fourth with a 3-pointer, giving the Pistons their first 20-point lead of the season, but VanVleet’s 3-pointer made it 91-83 with 3:39 to play. Cunningham put the margin back to 11 with a 3-pointer with 2:41 left, and Detroit clinched the game from the free-throw line.

Casey, who coached from the Raptors from 2011-18, has now beaten them five straight times with the Pistons.

”I don’t get any joy from beating Toronto. Getting fired is part of the business and that’s a long way back in my rear-view mirror these days,” he said. ”Fred and Pascal are like sons to me. I helped them get started in this league and I’m proud to see what kind of players they have become. I hope they both end up on the All-Star team.”

TIP-INS

Raptors: Toronto was starting a five-game road trip and a stretch of eight of 10 games away from home. … VanVleet came into the game having made at least four 3-pointers in a franchise-record nine straight games, the longest streak in the NBA this season. He missed eight of his first 11 attempts, but extended the record with a 3-pointer with 7:06 to play.

Pistons: Detroit has won five of its last eight, but all three losses have been by at least 29 points, including a 133-87 defeat by the Chicago Bulls on Tuesday.

HIGH SCHOOL REUNION

Cunningham and Barnes played a year together at Monteverde Academy, but Barnes doesn’t see any rivalry developing between the two as they contend for Rookie of the Year.

”That’s my brother out there, and it means a lot for both of us to be able to play on the same NBA floor,” Barnes said. ”We’re not paying any attention to anything about awards, and we’re certainly not worried about competing over one.”

UP NEXT

Raptors: Visit the Milwaukee Bucks on Saturday.

Pistons: Host the Phoenix Suns on Sunday in a game originally scheduled for Jan. 12.