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.
Patrick Peterson's diabetes could impact decision to play during pandemic
Cardinals cornerback Patrick Peterson, who has diabetes, said Thursday that he'd feel comfortable playing amid the coronavirus pandemic if proper safety protocols, such as temperature checks and wearing masks and gloves, are followed.
Melvin Gordon roasts Chargers when talking about playing with no fans
When asked about possibly playing in front of no fans, Melvin Gordon jokes around saying he already played with no fans when he was with the Chargers.
Ravens LB Matthew Judon signs $16.3M franchise tender
Ravens outside linebacker Matt Judon has signed his $16.3 million franchise tender, the team announced Thursday. The deadline for tagged players to sign a long-term deal in July 15.
Saquon Barkley's strength is off the charts
Saquon Barkley shows off his incredible strength by squatting six plates on each side.
Ravens' Harbaugh: No conventional offense for Lamar Jackson
Ravens quarterback Lamar Jackson might have been the NFL's MVP in 2019, but coach John Harbaugh said Thursday that a key to Jackson's evolution will be finding more success when throwing the deep ball.
Flacco ready to back up Darnold, but eager to be starter
Joe Flacco is embracing the opportunity to back up Sam Darnold, even though his goal is a starting role down the line.