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.
According to former NBA player Jayson Williams, Barkley ate McDonald's breakfast at practice while being exercising on a bike and yelling at his teammates.
Charles Barkley says that while the Warriors are a better offensive team with Kevin Durant, Golden State still has the same weaknesses as last season. Despite this, Barkley believes the Warriors are the favorites to win next season.
Allen Crabbe was upset three years ago when he wasn't selected until the second round of the NBA draft. His new contract with the Blazers alleviates some of that disappointment.