FOXBOROUGH, Mass. (AP)His team clutching a two-point lead, the ball on the 1-yard line and the season in the balance, Mac Jones decided to improvise.

Facing third-and-goal, the Patriots quarterback looked to his left and saw a Dolphins defense guarding against a run and linebacker Duke Riley spread out covering Jakobi Meyers. Jones made eye contact with his receiver, took the snap and tossed a short fade where only Meyers could reach it. He did, falling into the end zone for a touchdown.

It may prove to be the play that saved the Patriots’ season.

Jones added another touchdown pass to Tyquan Thornton and Kyle Dugger intercepted Teddy Bridgewater and returned it 39 yards for a go-ahead TD late in the third quarter as the New England kept its playoff hopes alive by rallying to beat Miami 23-21 on Sunday.

”We made some big plays in some big moments and that’s what the NFL’s all about,” Jones said.

The Patriots (8-8) snapped a four-game losing streak to their AFC East rivals and can earn a playoff berth with a win at Buffalo next week. Jones finished 20 of 33 for 203 yards.

”We’re still alive,” center David Andrews said.

The Dolphins (8-8) entered with a chance to clinch a postseason berth with a victory and loss by the New York Jets at Seattle. Instead, Miami lost its fifth straight game and will need to win next week against the Jets and Buffalo to beat New England to qualify for the postseason for the first time since 2016.

Miami played without quarterback Tua Tagovailoa, who’s in the concussion protocol for the second time this season. Bridgewater started in his place and was solid, completing 12 of 19 passes for 161 yards and a touchdown before leaving late in the third quarter with an injured right ring finger after being picked off by Dugger.

Bridgewater, who didn’t return, was replaced by Skylar Thompson. McDaniel thinks Bridgewater suffered the injury on the pick-6 trying to make a tackle. The team will wait to find out the extent of the injury over the next few days.

”We still have games to play,” McDaniel said. ”We have one in particular against the New York Jets that we have to respond to.”

Thompson had an interception and a late TD pass to Mike Gesicki to trim the deficit to 23-21. He finished 12 of 21 for 104 yards.

”Our backs are against the wall,” Thompson said. ”What this week comes down to is fighting. We’ve got to find a way to get into the dance.”

The Dolphins were already shorthanded, missing left tackle Terron Armstead (toe/pectoral muscle/knee/hip), cornerback Xavien Howard (knee), and linebacker Bradley Chubb (ankle/hand).

New England was without defensive backs Jalen Mills (groin), Jack Jones (knee) and Marcus Jones (concussion), along with wide receiver DeVante Parker and tight end Jonnu Smith, who both have concussions.

It left Jonathan Jones and Myles Bryant as the starters at cornerback, with practice squad elevation Tae Hayes providing support in certain sets as New England stuck mostly to zone.

The Dolphins mostly played it safe offensively, running the ball often, with Bridgewater sticking mostly to short and intermediate passing routes.

After exchanging touchdowns in the first half, the teams combined for six punts and a missed field goal by Miami. The Dolphins broke the stalemate in the the third quarter when Bridgewater capped a five-play, 41-yard drive with a 2-yard shovel pass to Raheem Mostert that made it 14-7.

Nick Folk cut into the lead on New England’s next series with a 49-yard field goal.

Miami was facing third down on the next drive when Bridgewater threw into traffic looking for Trent Sherfield. Dugger picked it off and returned it 39 yards for his TD. But Folk’s extra point banged off the upright, leaving the score at 16-14.

It was Dugger’s third score of the season. It marked the fourth straight week the Patriots have had a defensive score and their seventh of the season.

”Once I got my hands on the ball, I needed to score,” Dugger said. ”To me, it’s not a surprise. It’s just something I’ve known the defense is going to fight.”

Bridgewater entered the medical tent for evaluation after the INT and was replaced by Thompson, who was picked off by Jonathan Jones.

Two series later, the Patriots went up 23-14 on Jones’ TD pass to Meyers.

”I don’t think we have the men in that locker room that have the character to quit,” safety Devin McCourty said. ”We’ve got one more opportunity that we’re guaranteed.”

GETTING DEFENSIVE

The Patriots’ seven defensive touchdowns this season are the most in franchise history and most by any team since the 2017 Jaguars. New England beat Jacksonville that season in the AFC championship game.

INJURIES

Dolphins: S Jevon Holland visited the medical tent after leaving with an arm injury early in the second quarter. … OT Kendall Lamm left in first half with an ankle issue.

Patriots: LB Ja’Whaun Bentley jogged off on his own power after a collision in the third quarter. … Meyers left with a shoulder injury following this touchdown. … CB Jonathan Jones walked off on his own power after being shaken up late in the fourth.

UP NEXT

Dolphins: Host the Jets next Sunday.

Patriots: Visit the Bills next Sunday.

AP NFL: https://apnews.com/hub/nfl and https://twitter.com/AP-NFL