Cameron Wake sacked Andy Dalton for a safety with 6:38 left in overtime, and Miami beat the Cincinnati Bengals 22-20 on Thursday night.

On third-and-10 from the 8, Dalton retreated to the goal line and was tackled by Wake coming up the middle for the third overtime safety in NFL history. The officials immediately signaled the score, which was upheld following a replay review.

“You just have to do whatever you can to get to the quarterback,” Wake said. “It couldn’t have come at a better time. How much better could it have been than to have a d-lineman seal the deal?”

The Pro Bowl end totaled three sacks, and Cincinnati committed four turnovers that might have meant a difference of 17 points.

The Dolphins (4-4) won for the first time since their 3-0 start and snapped a four-game winning streak by the Bengals (6-3).

“You never want to lose four games in a row,” coach Joe Philbin said, “and we had an excellent football team coming in town. It was time for us to step up and we had to make a decision _ what are we going to be? And I thought they answered the bell pretty well tonight.”

The Bengals still enjoy a two-game lead in the AFC North, but their ranks are rapidly thinning. Defensive tackle Geno Atkins left the game in the second quarter with a knee injury, and coach Marvin said the injury appeared to involve the All-Pro’s anterior cruciate ligament, which would be season-ending.

The teams traded punts to start overtime. After Cincinnati’s Terence Newman was called for a 38-yard pass interference penalty, the Bengals dug in and forced another punt that pinned them deep, setting up the safety by Wake.

“My eyes were downfield, and he was there pretty quick,” Dalton said, adding he thought he was out of the end zone.

According to STATS, Minnesota’s Mike Merriweather had the first NFL overtime safety in 1989 against the Los Angeles Rams, and Chicago’s Adewale Ogunleye had the second against Tennessee in 2004.

“I don’t think anyone expected the game to end on a safety,” Miami quarterback Ryan Tannehill said.

The Bengals lost despite totaling 28 first downs and 465 yards while holding Miami to three third-down conversions. They could have tried a 56-yard field goal in overtime but punted to the Dolphins instead.

“We had a chance, maybe,” Lewis said, “but we felt better about pinning them down.”

Lewis made another questionable decision at the end of the first half. When the Bengals started from their own 15 with no timeouts and 45 seconds left, he decided against running out the clock.

His aggressive approach backfired when Dalton’s pass was intercepted by Dimitri Patterson, setting up a 36-yard field goal by Caleb Sturgis to put Miami up 10-3 at halftime.

Mike Nugent kicked a 54-yard field goal with 1:24 remaining in regulation to put the Bengals ahead, but Miami answered with a 50-yard drive, and Sturgis made a 44-yard field goal with 11 seconds left to force overtime.

Brent Grimes returned an interception 94 yards for a touchdown to put the Dolphins up 17-3 midway through the third quarter, but they squandered a two-touchdown second-half lead for the second time in five days. On Sunday in a loss at New England, they were outscored 24-0 in the final 24 minutes.

Cincinnati’s Giovani Bernard scored on an electrifying tying 35-yard touchdown run in the third quarter that covered perhaps twice that much ground. He started right, doubled back left, weaved up the sideline, cut back across the middle and somersaulted in the end zone, leaving Dolphins sprawled in his wake all along the way.

The run took 16 seconds. At least four defenders had a shot at him, including Grimes, who missed twice _ once in the backfield as the play unfolded.

Cincinnati’s Marvin Jones was kept out of the end zone four days after he caught four touchdown passes. Dalton’s 50-yard touchdown pass to Jones was negated by a holding call against Jermaine Gresham as the Bengals sputtered four days after scoring 49 points to beat the Jets.

The Bengals drove 64 yards for a field goal in the second quarter to take a 3-0 lead, and mounted an 80-yard drive for a touchdown in the third quarter. But Grimes’ interception represented a potential 14-point swing, because the Bengals were at the Miami 10.

Notes: Bernard bruised his ribs in the fourth quarter, but the injury wasn’t believed to be serious. … Miami G Richie Incognito left the game in the second quarter with a neck injury, and CB Nolan Carroll suffered a concussion, both in the second quarter. … The Dolphins improved to 6-0 on Halloween.