DETROIT — Jerami Grant's driving layup on the final play came too late, and the Houston Rockets held on for a 103-102 victory over the Detroit Pistons on Friday night.

Down one with 3.4 seconds remaining, the Pistons inbounded to Grant, who faked a handoff to Blake Griffin and then drove down the right side of the lane. Time clearly ran out before he laid the ball in, but he was also bumped by Houston's P.J. Tucker.

Replays showed that contact also came after time expired, and after a review, the game ended with the Rockets holding on.

“I tried to wait as long as I could before I fouled him," Tucker said. "He got a little edge on me.”

Grant scored 21 points for Detroit, which rallied from a 20-point second-quarter deficit and nearly erased a four-point gap late in the fourth. Griffin's 3-pointer with 29.9 seconds remaining made it 103-102, and the Pistons stopped Houston at the other end to set up Grant's final bid.

Detroit coach Dwane Casey felt a foul could have been called earlier on the final play. Grant was pressured quickly after receiving the ball.

“I thought he got fouled three times before he got to the rim," Casey said.

Eric Gordon scored 20 points for Houston, which snapped a three-game losing streak. The Rockets were without John Wall and Christian Wood but had seven players score in double figures.

“Everybody kind of played a role and did their job. It feels good," Houston coach Stephen Silas said. "The crazy part is, if that foul had been point-one second earlier, then we wouldn’t feel so good, I guess.”

It was an ugly first quarter for the Pistons, who turned the ball over nine times and trailed 34-21 at the end of the period. David Nwaba’s layup put Houston up 43-23 in the second.

The Pistons, however, have been a bit more competitive this season than their league-worst 3-12 record suggests. They chipped away at the deficit and trailed 55-47 at halftime despite the fact that Griffin hadn’t scored yet.

Grant’s 3-pointer put the Pistons ahead in the third, and they finished the quarter leading 81-77.

TIP-INS

Rockets: Wood, who went from Detroit to Houston in a sign-and-trade this off-season, missed the game against his former team with a sprained right ankle. Wall is dealing with left knee issues.

Pistons: Wayne Ellington scored 18 points — all on 3-pointers — and was a big part of Detroit's comeback. ... Delon Wright also scored 18. ... Griffin finished with seven points and 10 rebounds.

KEY SEQUENCE

With Detroit down 97-95, Mason Plumlee secured a defensive rebound, but when he held the ball behind his head, Houston's Jae'Sean Tate ripped it away from him and drew a foul with 2:05 remaining. Tate made the first free throw and missed the second, but the Pistons were called for another foul on that rebound. Tucker's two free throws made it a five-point game.

UP NEXT

Rockets: Visit the Dallas Mavericks on Saturday night. Dallas beat Houston 113-100 on Jan. 4.

Pistons: Host the Philadelphia 76ers on Saturday night. That's the first of two straight games the teams are scheduled to play in Detroit.

___

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

___

More AP NBA: https://apnews.com/NBA and https://twitter.com/AP_Sports