The Houston Texans moved to 4-1 on the season thanks to Ka'imi Fairbairn drilling a 59-yard game-winning field goal as the clock hit zero against the Buffalo Bills on Sunday at home.

The 23-20 loss drops Buffalo to 3-2 on the year. 

It looked to be Houston in complete control of this game, but that all changed when Josh Allen finally got something going on offense in the second half.

CLICK HERE FOR MORE SPORTS COVERAGE ON FOXNEWS.COM

C.J. Stroud throws pass

Houston Texans quarterback C.J. Stroud warms up before the game against the Buffalo Bills at NRG Stadium. (Troy Taormina-Imagn Images)

While Allen didn’t have a good game overall through the air (9-for-30, 131 yards, one touchdown), he orchestrated a touchdown drive to start the second half, finding Dalton Kincaid for 26 yards to set up a James Cook touchdown to make it 20-10.

Then, after the defense forced a three-and-out, Allen found rookie Keon Coleman, who flew down the left sideline and kept his feet in bounds for a 49-yard score.

At that moment, it was a three-point game with C.J. Stroud and the Texans’ offense stalling despite a hot first quarter.

BILLY SHAW, HALL OF FAME GUARD AND BILLS LEGEND, DEAD AT 85

Stroud made it 14-3 thanks to Nico Collins’ blazing speed getting him past Buffalo’s secondary, and the second-year quarterback threw a dime to him for a 67-yard touchdown. And he previously saw Cam Akers bust a 15-yard run on the team’s first drive of the game for the opening touchdown.

But despite not finding the end zone the rest of the game, Allen gave the Texans a chance at the end of the game thanks to Buffalo never moving from their own 3-yard line. A punt saw Robert Woods give the Texans better field position with 16 seconds left after a 13-yard run to Buffalo’s 46.

Josh Allen runs off field

Buffalo Bills quarterback Josh Allen jogs off the field after a play during the first quarter against the Houston Texans at NRG Stadium. (Troy Taormina-Imagn Images)

Running back Dare Ogunbowale picked up five yards, setting up Fairbairn's 59-yard kick that capped the hard-fought victory.

While Stroud was without Collins for much of this game due to a hamstring injury, he still threw for 331 yards on 28 of 38 through the air with one touchdown and one interception.

And it was Stefon Diggs, the ex-Bills star who many said was in his "revenge game" this week, leading the way for Houston with 82 yards on six catches.

For the Bills, with Allen being stopped in the pass game, Cook provided solid rushing with 82 yards on 20 carries and his score. 

Ka'imi Fairbairn kicks field goal

Houston Texans' Ka'imi Fairbairn kicks a 47-yard field goal during the second half of an NFL football game against the Buffalo Bills, Oct. 6, 2024, in Houston. (AP Photo/Eric Gay)

CLICK HERE TO GET THE FOX NEWS APP

But the Bills, without Allen’s favorite target this season, Khalil Shakir, had no answer for what the Texans were bringing up front with their pass rush.

Follow Fox News Digital’s sports coverage on X and subscribe to the Fox News Sports Huddle newsletter.