Yao scored 31 points -- eight in the extra periods -- and Ron Artest added 26 to lead the Rockets to a 106-101 double-overtime victory Wednesday night against the Pistons, who played without injured stars Richard Hamilton (groin), Allen Iverson (back) and Rasheed Wallace (calf).
Aaron Brooks scored seven of his 14 points in the second extra period, helping the Rockets stay in third place in the Western Conference standings.
The Rockets opened the second overtime with a 10-0 run, with Yao scoring inside to put Houston up 102-92.
"I need to be more aggressive, I guess," Yao said. "I've been in this situation before. I think I need to do more for the team."
Brooks started the decisive spurt with a 3-pointer before Artest drove for two layups and Yao hit a mid-range turnaround.
"We did a good job of finishing up the game," said Brooks. "Yao did a good job. We got him the ball in the post at the end of the game and that was good."
"It's crazy how frustrating it is," said Stuckey. "I'm trying to be as aggressive as I can, but I just ran out of gas. We fought as hard as we could."
Afflalo sank a 3-pointer to end Detroit's drought in the second overtime and Walter Herrmann hit a free throw to pull the Pistons within six. After Artest missed a 3, Herrmann hit a 3 for Detroit with 28 seconds to go, cutting Houston's lead to 102-99.
Brooks went 4-for-4 from the free-throw line on the Rockets' next two possessions to finally secure the victory. The Rockets have won 13 of their last 15 home games and moved a half game ahead of Denver for third place overall in the West.
"We needed to win and we won, even though we didn't play very well the whole game," said Rockets forward Luis Scola, who had 14 points. "We hung in there, we fought."
Yao scored on four straight possessions to give Houston an 82-79 lead with less than two minutes left in the fourth quarter.
The Pistons did a solid job defending Yao for most of regulation, holding Houston's center to 14 points through three quarters. Yao did not attempt a free throw until there was 3:12 left in the fourth quarter.
The Rockets finally found ways to get him the ball and Yao did the rest.
"We had to go with what was working," Brooks said. "Yao was playing unbelievable. I wanted to get him in the key, where he is most effective."
The Pistons grabbed two offensive rebounds and Stuckey hit a running shot in the lane to cut the Rockets' lead to one. Artest missed a long jumper, and Stuckey's free throw with 56 seconds left tied the game at 82.
Scola lost the ball on a drive, and Herrmann rimmed out a 3-pointer at the buzzer to force overtime.
The Rockets built an 88-85 lead in the extra period before Stuckey sank two free throws with 1:29 left. Yao hit two free throws on Houston's next trip, but Stuckey's driving layup with 26 seconds left cut Houston's lead to 90-89.
Kyle Lowry made a free throw before Stuckey easily drove for another layup to tie it at 91. Artest missed an off-balance jumper as time expired in the first overtime.
The Rockets outscored Detroit 15-10 in the second extra period.
"We fought and gave ourselves a chance," McDyess said. "But at the end, it wasn't there for us."
The Rockets led 42-38 at halftime after shooting 50 percent (20 of 40) in the first half.
Detroit shot 31 percent (14 of 45) in the first half, but stayed close by going 9-for-12 from the free-throw line. The Rockets took only two free throws in the half and went 1-for-6 from 3-point range.
The Pistons rallied from five points down to take the lead in the third quarter. Afflalo sank a 3-pointer, McDyess scored twice inside and Detroit shot 58 percent in the quarter to take a 65-64 lead to the fourth.
Will Bynum drove past Lowry for two layups in the first minute to stretch Detroit's lead to five, its biggest of the game. Detroit led 79-75 in the fourth quarter before Yao took over inside.
The Rockets are 2-1 in overtime this season; Detroit dropped to 2-4. ... Detroit grabbed 21 offensive rebounds and its 26 second-chance points were a season high for a Houston opponent. ... Detroit coach Michael Curry said Iverson would have tests on his back on Thursday and Friday. Curry said Wallace was also likely to miss Friday's game against the Los Angeles Clippers.
Doncic's triple-double helps Mavs top Blazers
Luka Doncic records 15 points, 15 assists and 10 rebounds as the Mavericks go on to defeat the Trail Blazers 132-112.
Booker leads Suns past Jazz 105-97 for 8th straight win
— Devin Booker had 43 points and a career-high 12 rebounds, Chris Paul scored 15 of his 21 points in the fourth quarter and the Phoenix Suns extended their winning streak to eight with a 105-97 victory over the Utah Jazz on Wednesday night.
Booker leads Suns to 8th straight win with 43 points
Devin Booker unloads 43 points to lead the Suns to a 105-97 win vs. the Jazz.