ORCHARD PARK, N.Y. (AP) — Josh Allen ran for a 26-yard touchdown on fourth down with 2:17 left, sealing the Buffalo Bills' 30-21 win over the Kansas City Chiefs on Sunday and handing the two-time defending Super Bowl champions their first loss of the season.

James Cook rushed for two touchdowns and Allen threw a 12-yard TD pass to Curtis Samuel for Buffalo (9-2), which closed the gap on Kansas City (9-1) in the race for the AFC’s top seed.

Patrick Mahomes and Chiefs were the NFL's last undefeated team and finally ran out ways to eke out one-score victories and overcome second-half deficits. The Chiefs had won 15 straight, including playoffs, since they fell 20-14 to the Las Vegas Raiders on Dec. 17, 2023.

The Bills have won six straight and moved closer to their sixth straight AFC East title.

Buffalo has defeated the Chiefs in four straight regular-season meetings, though Kansas City holds the postseason edge, having won the past three matchups dating to 2020. And it wouldn't be a surprise if the teams met yet again in January.

The packed stadium erupted in chants of “MVP!” as the videoboard showed replays of Allen’s touchdown. Bills coach Sean McDermott opted to go for it on fourth-and-2 instead of kicking a field goal for a five-point lead. Allen faked a pass to his left and then broke up the middle, where he bounced off two Chiefs defenders before crossing the goal line.

Allen played through a sore throwing hand, which was examined on the sideline during the game. He finished 27 of 40 for 262 yards with the TDs passing and rushing and an interception.

The rushing touchdown was the 58th of Allen’s career, moving him into second on the Bills list, one ahead of O.J. Simpson, and seven behind Thurman Thomas. Allen’s two-touchdown outing also increased his total to 244, tying Jim Kelly for first in team history.

Buffalo’s defense ended Kansas City's desperate final drive linebacker Terrel Bernard intercepted Mahomes.

Mahomes finished 23 of 33 for 196 yards with three touchdown passes -- two to tight end Noah Gray and another to Xavier Worthy — and two interceptions.

Names and numbers

The matchup was just the fifth since 1970 in Week 11 or earlier between teams with eight or more wins. ... Bills DE Von Miller had a sack, moving into sole possession of 17th place on the NFL list with 127 1/2 — one ahead of Derrick Thomas and a half-sack behind Rickey Jackson.

Injuries

Bills: WR Amari Cooper returned after missing two games with an injury to his left wrist. ... Starting RT Spencer Brown (ankle) did not play.

Up next

Chiefs: At Carolina next Sunday.

Bills: After a bye, host San Francisco on Dec. 1.