DETROIT (AP) Bojan Bogdanovic scored 32 points and the Utah Jazz withstood two big Detroit rallies to beat the Pistons 111-105 on Saturday night for their fifth straight victory.

Utah led by 22 points in the second quarter, but the Pistons came all the way back to tie it early in the fourth. The Jazz then went on an 18-2 run, but that big lead nearly slipped away as well. It was a one-possession game before Utah's Rudy Gobert made two free throws with 18.5 seconds left to make it 107-102.

''NBA games, there's lots of big leads that change hands,'' Jazz coach Quin Snyder said. ''For us to respond the way we did was a really good thing. We can be sharper down the stretch, I think all our guys know that, and that's something that we'll focus on and talk about, but that shouldn't cloud the fact that we came out with great focus and intensity on the defensive end and ... did respond when we needed to.''

The Jazz moved 1 1/2 games ahead of the Houston Rockets for the No. 4 spot in the Western Conference and pulled within a game of Denver for No. 3. Donovan Mitchell scored 25 points for Utah.

Christian Wood scored a career-high 30 points for Detroit. The Pistons lost for the 17th time in their last 21 games.

The Pistons trailed 105-102 after Jordan McRae's layup with 42.1 seconds left. Mitchell slipped at the other end, but while he was on the floor, he managed to throw a crosscourt pass to teammate Joe Ingles. The ball ended up inside with Gobert, who was fouled just before the shot clock was going to expire.

''I knew where Joe was, so I knew if I got the ball I'd be able to get it there,'' Mitchell said. ''It was just a matter of grabbing it.''

Gobert made both free throws, and the Jazz were able to close out the win.

Utah swept a four-game road trip that also included games against the Cavaliers, Knicks and Celtics. The Jazz led Detroit 28-17 after one quarter and 55-39 at halftime.

''We weren't aggressive enough in the first quarter so maybe we will start trapping in the first part of the game or whatever it takes to get us going,'' Pistons coach Dwane Casey said.

It was 79-73 after three before the Pistons scored the first six points of the fourth, tying it on a driving bank shot by Bruce Brown.

LONG RANGE

The Pistons made 18 3-pointers in each of their previous two games. They were just 9 of 30 on Saturday.

Utah was shooting a league-leading 38.5% from beyond the arc entering the day. The Jazz were 10 of 33 in this game.

TIP-INS

Jazz: Gobert had 10 points and 12 rebounds.

Pistons: Brown played for the first time since Feb. 23. He'd been out with left knee soreness. ... Wood surpassed the 1,000-point mark for his career. He was six points shy entering the game. ... Wood's previous career high of 29 points was set Wednesday against Oklahoma City.

UP NEXT

Jazz: Host Toronto on Monday night.

Pistons: At New York on Sunday night.

---

Follow Noah Trister at https://twitter.com/noahtrister

---

More AP NBA: https://apnews.com/NBA and https://twitter.com/AP-Sports

Copyright 2020 by STATS LLC and Associated Press. Any commercial use or distribution without the express written consent of STATS LLC and Associated Press is strictly prohibited.