Andre Johnson caught eight passes for 118 yards and Foster scored in his fifth straight game. The Texans (7-1) clamped down on defense in the second half to put the game away.
Houston kept up the best start in franchise history heading into next Sunday's showdown with Chicago (7-1) at Soldier Field.
"We're happy to be 7-1 at the halfway mark," Schaub said. "But we're not finished. We've got to go into a tough environment against a very good team next Sunday night."
Williams had a sack and five tackles in his first game at Reliant Stadium since signing a six-year, $100 million contract with the Bills (3-5) in the offseason. The Texans made the defensive end the top overall pick in the 2006 draft and he's still Houston's career sacks leader (53). But Williams became a free agent after last season, and the Texans opted against breaking the bank to keep him and let him go.
Williams said this week he was upset that Houston general manager Rick Smith never even made him an offer to stay. He was showered with boos every time he made a play on Sunday. After the game, though, he exchanged handshakes and hugs with several Texans and coach Gary Kubiak.
"It was great," Williams said. "I think the biggest thing for me is if you go out and make a play and you get booed, I know I'm in your heart. That's the most important thing. If it had been quiet, then I would have felt something different. But I know you're thinking about me."
Schaub won for the 10th time in 11 starts. He completed 19 of 27 passes for 268 yards. He threw a 39-yard touchdown pass to Owen Daniels late in the first quarter, but Williams sacked him the second quarter and wagged his finger at his former team.
"I have to look at the film," Kubiak said, "but it looked like Mario played pretty darn good."
The Texans led only 7-6 at the break, mustering only 174 yards and nine first downs in the first half. They committed six penalties in the half, some of them holding calls.
"We need to take a hard look at that and be critical of ourselves, because we hurt ourselves the whole first half," Schaub said.
Ryan Fitzpatrick completed 14 of 17 passes in the first half, then began the third quarter with three straight incompletions. Rookie Keshawn Martin returned the ensuing punt 26 yards to the Buffalo 43 and the Texans started to seize the momentum.
Schaub completed a 34-yard pass to Johnson to the Bills 4, and cornerback Aaron Williams hurt his right knee making the tackle and left the game. Foster scored two plays later, his 11th touchdown of the season.
"We played very good in the second half," Kubiak said. "Offensively, we did away with the things that were hurting us."
After the game, Aaron Williams left the Bills' locker room on crutches.
Rian Lindell kicked a 39-yard field goal with 7:41 left in the third quarter. The Bills went 2 for 11 on third down and went 0 for 3 in the red zone.
"If you can hold your opponents to field goals or nothing at all once they get in the red zone, your chances of winning go up," Houston cornerback Johnathan Joseph said.
The Texans were geared toward stopping Buffalo's running game, and the Bills mustered only 119 yards and six first downs in the second half. Buffalo rushed for a season-low 78 yards. Fred Jackson had only 21 yards and C.J. Spiller had 39 -- 22 on one run late in the first half.
"We didn't want to let them run the football," Texans defensive coordinator Wade Phillips said. "We had to stop the running game and I thought we did that."
The Texans put the game away with a 68-yard TD drive spanning 6½ minutes. Johnson caught two passes to go over 100 yards for the 40th time, and Schaub rolled right and found tight end Garret Graham for a touchdown with 11:25 remaining.
"We did a lot of things that are not good enough for us to win consistently," Kubiak said. "But yet we found a way to survive."
Fitzpatrick completed 25 of 38 passes for 239 yards. ... The Bills allowed three sacks after giving up a total of eight in their first seven games. ... Jackson went over 4,000 yards rushing in his career. ... Foster went over 100 yards rushing the 20th time in his career and fourth time this year. ... Texans RB Ben Tate sat out with a hamstring injury. ... Texans improved to 39-5 under Kubiak when rushing at least 30 times.
Tom Brady has won his appeal against the NFL, with U.S. District Judge Richard M. Berman criticizing commissioner Roger Goodell for dispensing "his own brand of industrial justice."
Tom Brady wasn't even present for Thursday night's preseason finale between the Patriots and Giants at Gillette Stadium, but he was still the story of the night.
In his weekly radio interview, Patriots president Jonathan Kraft said the team feels vindicated by a federal court decision to overturn Tom Brady's ban and that the team is "ecstatic" for Brady.
Tim Tebow threw two touchdown passes against the New York Jets, his former team, in a strong effort to make the Philadelphia Eagles' 53-man roster.
A week of tumult and controversy continued for the Washington Redskins, who made an off-field stir related to their ticket policy on Thursday before their final preseason game.
Jason Pierre Paul plans to return to the New York Giants next week and the team will examine his hand and make a determination about when he might be available to play, according to a source.