When Miami Dolphins rookie receiver Jarvis Landry dived into the end zone for a fourth-quarter touchdown, he was just getting started. A replay review upheld the score, and Landry then sprinted up and down the sideline in a celebration of redemption.

Landry bounced back from a potentially disastrous fumble, and the Dolphins ended a streak of three consecutive losses to Buffalo, overcoming a third-quarter deficit to win 22-9.

"It was great to swing the tide," Landry said. "It was good not to be the little brother."

Ryan Tannehill shook off five sacks to throw late touchdown passes of 7 yards to Brandon Gibson and 8 yards to Landry. Tannehill went 26 for 34 for 240 yards, and Lamar Miller rushed for 86 yards.

Miami trailed 9-3 before outscoring their AFC East rivals 19-0 over the final 18 minutes. The Dolphins improved to 6-4, their best record after 10 games since 2008.

"You have to start playing good football this time of the year," coach Joe Philbin said.

The Bills, trying to end a 14-year playoff drought, fell to 5-5 with their second loss in a row.

Stymied by Buffalo's front four in recent meetings, the Dolphins had scored one touchdown in 33 possessions against the Bills before late TD drives of 80 and 63 yards. That was quite a rally by a team that hadn't won a close game all season.

Otherwise stout a defense did the heavy lifting for Miami, which scored a safety on a penalty.

The Bills, ranked last in the NFL in red-zone touchdown efficiency, mounted grinding drives of 67 and 85 yards on their first two possessions. But Miami held them to a field goal each time, and those were their best TD chances.

The Bills have reached the end zone once in their past nine red-zone trips.

"In the first half we had two drives we didn't finish," coach Doug Marrone said. "In the second half we just didn't play well."

With the Dolphins leading 12-9, Landry lost a fumble on a kick return, but their defense again dug in, and former Miami kicker Dan Carpenter missed a 47-yard field goal try. He made earlier attempts of 33, 21 and 46 yards.

The Dolphins, also ranked poorly in red-zone efficiency, missed chances early themselves. They came away with three points from trips inside the 20 on their first two possessions, and didn't reach the end zone until 42 minutes into the game.

Miami led 10-9 before scoring a safety when Kyle Orton was flagged for intentional grounding from the end zone. Under pressure from Olivier Vernon, Orton threw a pass that landed closer to the Bills sideline than to any player.

"It set the tone for how we were playing defense in the second half," Philbin said.

The Bills padded their NFL-leading sack total while working against Miami's makeshift line, reshuffled after left tackle Branden Albert's season-ending knee injury last week. But Tannehill kept getting back up, and he finished with a passer rating of 114.8.

Orton's rating was 69.7. He went 22 for 39 for 193 yards, and the Bills — missing their top two running backs — netted only 54 yards on the ground.

Marrone said he's not considering benching Orton in favor of E.J. Manuel, the starting quarterback at the beginning of the season.

___

AP NFL website: www.pro32.ap.org and http://twitter.com/AP_NFL

___

Follow Steven Wine on Twitter: http://twitter.com/Steve_Wine