ORCHARD PARK, N.Y. (AP) — Josh Allen couldn’t entirely overlook how sloppy the Bills' offense played, having difficulty closing out a 27-17 win over the Los Angeles Chargers on Sunday.

Buffalo’s defense cleaned up whatever mess they created.

“Yeah, we can be better, especially in the fourth quarter,” Allen said. “But I don’t want to make a mountain of a molehill. Obviously, we’ve got a lot of work to do, but 8-3 is pretty good.”

Though they never trailed, the Bills overcame turning over the ball on three straight fourth-quarter possessions to maintain their one-game edge over Miami atop the AFC East standings. Allen threw an interception and muffed a snap, while running back Devin Singletary also fumbled in that stretch.

Linebacker A.J. Klein had 14 tackles and 1 1/2 sacks, and Tre’Davious White’s fourth-quarter interception with 5:17 left essentially sealed the victory. The turnover led to Tyler Bass' 43-yard field goal to regain Buffalo a two-score edge.

“All we can do is go out there and try to get some takeaways, that’s it,” safety Micah Hyde said. “The fourth quarter, we came up with a big pick by Tre’Davious, huge play, and also a fourth-down stop.”

The defense’s performance wasn’t perfect. It allowed Justin Herbert’s 55-yard completion to Tyron Johnson in the final minute. Buffalo, however, limited the Chargers to Michael Badgley hitting a 27-yard field goal on their five final possessions.

Allen threw for a touchdown and ran for another score, and receiver Cole Beasley completed a 20-yard touchdown pass to rookie Gabriel Davis.

The Chargers dropped to 3-8 in a game in game that exemplified their season-long struggles. Though they didn’t blow a double-digit lead as they’ve done five previous times, the Herbert-led offense was erratic, lacking a finishing touch despite the return of running back Austin Ekeler, who missed six games with a hamstring injury.

Ekeler finished with 44 yards rushing and 11 catches for 85 yards.

The offensive struggles spoiled an outstanding performance by defensive end Joey Bosa, who had three sacks and a fumble recovery.

“Pretty upset,” said Bosa, who upped his career total to 47 1/2 sacks, moving into fifth place on the team list and a half-sack ahead of Junior Seau. “Really wanted to pull it out. Hard to feel excited after a tough game like that.”

Coach Anthony Lynn’s play calling was open to second guessing, especially after cutting Buffalo’s lead to 24-14 on Joshua Kelley’s 1-yard plunge with 4:51 left in the third quarter.

Rather than attempt a field goal to cut the lead to 7, the Chargers gave the ball up on downs at Buffalo’s 26 when Ekeler was stopped for no gain on third down and Kelley lost a yard on fourth down on the opening play of the fourth quarter.

The final minute featured a comedy of errors in how the Chargers mismanaged the clock. Out of timeouts with the ball at Buffalo's 2 and the clock down to 25 seconds, the Chargers elected to run, Ekeler being stopped at the 1.

The clock ran down to 6 seconds before Herbert threw an incompletion. The game ended with Herbert being stopped on a keeper up the middle.

“As a team it wasn’t good enough,” Herbert said. “Offensively we underperformed. Defense came up with big stops and turnovers. Its’ on us and the offense.”

Herbert finished 31 of 52 for 316 yards, upping his season total to 3,016 and joining Kansas City’s Patrick Mahomes as the only players to top 3,000 yards passing in their first 10 career starts. Herbert was limited to one touchdown, a 5-yarder to Keenan Allen, ending the quarterback’s rookie record streak of multiple touchdown games at seven.

TRICKERY

The Bills resorted to trickery for a second consecutive game, with Beasley getting a pitch from Allen and lofting a 20-yard pass to wide-open Davis in the end zone early in the second quarter. It came after receiver Isaiah McKenzie completed a touchdown pass to Allen against Arizona.

INJURIES

Chargers: Right tackle Bryan Bulaga was active but did not play because of an illness. ... LB Denzel Perryman hurt his back after going head over heels in making a diving attempt to tackle Beasley in the second quarter. ... Casey Hayward (groin) had his streak of playing 106 consecutive games end, the NFL’s longest active among cornerbacks. His streak dated to 2013, Hayward’s second season with Green Bay.

Bills: None reported.

ALLEN VS. HERBERT

The game was the first in the NFL’s Super Bowl era to feature quarterbacks 24 or younger entering Week 12 with a 100-plus passer rating with a minimum of eight starts. Herbert ranked first among NFL QBs 24 and younger with a 104.7 passer rating, while Allen is second at 103.2.

UP NEXT

Chargers: host New England on Dec. 6.

Bills: They're scheduled to travel to play San Francisco for a prime-time game on Dec. 7, though location is uncertain after Santa Clara County banned contact sports teams from holding games and practices for the next three weeks.

___

More AP NFL: https://apnews.com/NFL and https://twitter.com/AP_NFL

Copyright 2020 The Associated Press. All rights reserved. This material may not be published, broadcast, rewritten or redistributed without permission.