Steve Francis had 16 points, including nine in the overtimes, but fouled out with 37 seconds left in the third extra period.
Though he played 50 minutes, Yao was clutch down the stretch with six points in the first two minutes of the third overtime.
“I still thought I was very tired,” Yao said. “I was tired to the point I felt numb. But I just had to keep going.”
Yao was 15-of-21 from the field, 11-of-13 from the line, and had 16 rebounds and seven assists as the Rockets played for the second straight night.
Atlanta coach Terry Stotts was impressed by Yao.
“We played zone to contain Yao and he still had 41 points,” Stotts said. “He’s a heck of a presence.
The 7-foot-6 center is averaging 20.7 points over the last nine games to raise his scoring average to a team-high 16.9 points. Yao is grabbing nine rebounds a game and ranks second in the NBA in shooting at 53.8 percent.
Yao will need all his strength against Duncan, the two-time league MVP.
Duncan, a 58.6 percent free-throw shooter, made 7 of 8 foul shots in the fourth quarter to finish with 25 points, and Tony Parker had 26 as the Spurs beat the first-place Minnesota Timberwolves 94-92 on Sunday.
Duncan, who finished with 25 points on 8-for-24 shooting, is second in the NBA behind Kevin Garnett with 44 double-doubles. The 7-foot Duncan is fifth in the NBA with 23.1 points per game and is third with 12.9 rebounds.
“He’s our heart and soul just like Kevin is Minnesota’s heart and soul,” Spurs coach Greg Popovich said.
Duncan averaged 19.3 points on just 37 percent shooting in San Antonio’s two wins over Houston this season.