This time, it was the Dolphins' turn to come back in the fourth quarter and they pulled out a victory after a major scare.
Tannehill earlier threw touchdown passes to wide receiver DeVante Parker, as he produced his second three-touchdown game of the season—he also did it against Oakland in Week 3.
Cornerback Xavien Howard came up with two interceptions for a second consecutive week and for the third time this season, a first in Dolphins history. In the process, Howard took over the NFL lead with seven interceptions.
Buffalo rookie first-round pick Josh Allen threw two touchdown passes to wide receiver Zay Jones, the son of former Dolphins linebacker Robert Jones, and the two also connected on a two-point conversion.
Allen also had 135 rushing yards, most of them on scrambles to escape pressure.
Stills' touchdown came after Buffalo had taken its first lead of the game.
Buffalo drove to the Miami 23-yard line on its next possession, but cornerback Bobby McCain and Robert Quinn came up with back-to-back sacks before kicker Steven Hauschka was wide left on a 55-yard field goal attempt.
Buffalo had one last chance and got to the Dolphins 25. A completion to Jones to the 5-yard was overturned after video review and on fourth-and-11 from the 30 a scrambling Allen under threw former Dolphins tight end Charles Clay, who was wide open in the end zone.
The Dolphins led 14-6 after a first half that featured 11 combined penalties and two special teams miscues by Buffalo.
For the second consecutive week, the Dolphins opened the game with a touchdown drive, Tannehill hitting Parker with a 18-yard touchdown pass to the first score.
A big play on the drive was a roughing-the-passer penalty that moved the ball ton the Buffalo 33-yard line. The drive also featured the first rushing attempt of the season for veteran running back Brandon Bolden, who gained 10 yards to the Bills 19.
Buffalo got into the end zone early in the second quarter when Allen threw a 15-yard touchdown pass to wide receiver Zay Jones, but Hautschka missed the extra-point attempt and the Dolphins still led 7-6.
The Dolphins needed six plays to get into the end zone, the scoring play coming on a 3-yard pass to Drake on second-and-goal. That came two plays after Tannehill hit Frank Gore with a 10-yard completion to convert a third-and-7 situation.
The first half ended with Allen trying a desperation pass into the end zone in a crowd of Dolphins defenders and Howard coming up with the ball.
Buffalo cut into the Miami lead when Hauschka made a 32-yard field goal at the end of the first drive of the second half to make the score 14-9. The big play on the drive was a 38-yard completion from Allen to fullback Patrick DiMarco.
The Bills took the lead early in the fourth quarter after Howard and Buffalo's Jordan Poyer traded interceptions.
That set the stage for the game-winning drive and a final defensive stop.
The Dolphins (6-6) will be back at Hard Rock Stadium to take on the New England Patriots. Buy tickets here.