ORCHARD PARK, N.Y. (AP) — Rookie Miles Sanders scored on a career-best 65-yard touchdown run and the Philadelphia Eagles snapped a two-game skid with a 31-13 win over the Buffalo Bills on Sunday.

Carson Wentz finished 17 of 24 for 172 and a touchdown passing in a game the Eagles blew open by scoring TDs 83 seconds apart spanning halftime.

Dallas Goedert scored on a 5-yard catch. Jordan Howard had a team-best 96 yards rushing and scored on a 3-yard run, and Boston Scott scored on a 4-yard run after Sanders left the game with a shoulder injury in the third quarter.

Linebacker Brandon Graham had one of the team's four sacks, and also forced and recovered quarterback Josh Allen's fumble, which led to Goedert scoring the go-ahead touchdown.

The Eagles improved to 4-4 in bouncing back from a 37-10 prime-time dud of a loss at Dallas last week, and amid questions the team lacked discipline. Cornerback Orlando Scandrick criticized Eagles leaders upon being released by the team. And offensive tackle Lane Johnson raised questions by suggesting Eagles players were showing up late for team meetings.

The Bills (5-2) squandered an opportunity to open 6-1 for the first time since 1993, and failed to answer skeptics as to whether their hot start is a result of a soft schedule.

Buffalo has faced just one opponent — New England — that entered this weekend with a winning record. And the Bills were coming off a week in which they rallied from a five-point fourth-quarter deficit to beat the winless Miami Dolphins 31-21.

The Bills were essentially trampled by the Eagles. The 218 yards rushing allowed was the most by Buffalo since giving up 273 against New England on Dec. 23. And Buffalo had not surrendered three touchdowns rushing since allowing three in a 2018 season-opening 47-3 loss at Baltimore.

Allen finished 16 of 34 for 169 yards with touchdown passes to Cole Beasley and Devin Singletary. Allen also fumbled three times, losing one.

The game turned in the final minutes of the first half with the Eagles trailing 7-3.

With Buffalo facing third-and-2 from its 28, Allen was running to his right with the ball tucked under his right arm, when Graham knocked it loose. Wentz hit a wide-open Goedert in the end zone five plays later.

Sanders then took off on the second snap from scrimmage in the third quarter. Stepping to his right, Sanders burst through a bid hole through the middle and followed Howard's block of linebacker Matt Milano to race up the left sideline. The rookie second-round draft pick then celebrated by leaping into a group of Eagles fans in the northeast corner of the end zone.

After Singletary scored to cut Philadelphia's lead to 17-13 with 9:36 left in the third quarter, Wentz responded by directing a six-play, 68-yard drive capped by Scott's touchdown. The drive began with Wentz with a 38-yard pass to Alshon Jeffery, who was wide open up the left sideline.

AGAINST THE WIND

The game was played with winds gusting from the west at 20 mph and in a persistent drizzle.

Bills punter Corey Bojorquez had the Eagles back-pedaling on his first punt into the wind by sailing it 57 yards to the Philadelphia 19. His second punt into the wind went 44.

Philadelphia's Cameron Johnston's two punts into the wind in the first half went 44 and 41 yards.

Buffalo's Stephen Hauschka missing a 53-yard field goal attempt wide right into the wind to end the first half.

LET'S BE FRANK

Bills running back Frank Gore became the NFL's fifth player to reach the career 19,000 yards from scrimmage plateau. The 15-year veteran hit the number on the button with an 8-yard rush just before the two-minute warning of the second quarter.

Gore entered the game with 18,980 yards from scrimmage, and 174 yards shy of matching Marshall Faulk for fourth on the list.

INJURIES

Eagles: Sanders left the game in the third quarter.

Bills: Starting RT Cody Ford was escorted to the locker room with five minutes remaining due to an elbow injury. CB Levi Wallace (undisclosed).

UP NEXT

Eagles: Open three-game homestand hosting Chicago on Nov. 3.

Bills: Close three-game homestand hosting Washington on Nov. 3.