MIAMI GARDENS, Fla. — Colin Kaepernick drew boos at the start of the game. By the end, he had Miami Dolphins fans holding their breath.

Ndamukong Suh tackled Kaepernick 2 yards short of the goal line as time ran out, and the Dolphins handed the San Francisco 49ers a franchise-record 10th consecutive loss by winning 31-24 Sunday.

Ryan Tannehill threw for 285 yards and three scores to compensate for an uncharacteristically sluggish Miami ground game.

Kaepernick, who has drawn mixed reactions for kneeling during the national anthem all season, was jeered loudly in the early going for his political views. He threw for 296 yards, ran for 113 and rallied the 49ers after they trailed 31-14 midway through the fourth quarter.

With the margin down to seven, Kaepernick moved the 49ers from their 38 to the 6 in the final 1:44, converting a fourth-and-11 along the way. But he threw incomplete on first down, and then was tackled from behind by the 305-pound Suh while trying to elude linebacker Kiko Alonso on the final play.

"I just played what I saw," Suh said. "I had a one on one against a guard. I needed to beat him and then get to the quarterback. It's not the cleanest or best way to get it done, but we got it done."

Kaepernick said the play was called as a pass, and he faked a throw before taking off.

"I thought we had a seam to get in there and didn't make it," he said.

Kaepernick passed for three TDs, but the 49ers (1-10) still haven't won since the season opener.

Instead, the Dolphins (7-4) extended their winning streak to six games, their longest since 2005.

"It's great to see our guys have fun at the end of the day," first-year coach Adam Gase said. "They understand a win in this league is hard to come by."

Tannehill went 20 for 30, ran for 34 yards and had no turnovers. He threw scoring passes of 16 yards to Dion Sims, 43 yards to Kenny Stills and 15 yards to rookie Leonte Carroo.

Kaepernick tried to keep up. He went 29 for 46 and also hurt the Dolphins with his legs, but fell to 0-6 as a starter this year.

Miami won even though Jay Ajayi had trouble finding running room behind an offensive line missing three starters. He gained 45 yards in 18 carries against a 49ers defense ranked last in the league against the run.

"They decided they were going to make us throw to win," Tannehill said. "So that's what we did."

Tannehill put the Dolphins ahead to stay with his 100th touchdown pass in his fifth NFL season, and Carroo's first career touchdown made it 31-14 with 11:31 left.

It was a different approach for the Dolphins, who had rallied in fourth quarter in their four previous games.

This time the opponents mounted a comeback. Torrey Smith made a one-handed catch for a 1-yard touchdown to help the 49ersclose to 31-24 with less than three minutes left, and they quickly forced a punt to set up the down-to-the-wire finish.

BOOS FOR KAEPERNICK

Kaepernick drew boos when he and the rest of the 49ers offense trotted onto the field for their first series, and more jeers and whistles just before the first snap.

The jeering followed criticism of Kaepernick for defending former Cuban leader Fidel Castro during a conference call Wednesday with the South Florida media. Castro, who died Friday, is widely reviled among South Florida's large Cuban American population.

DOLPHINS DEFENSE

Alonso recovered a fumble to end a 49ers threat and intercepted a deflected pass to set up a field goal. He has four takeaways in the past three games.

Teammate Cameron Wake had a sack for the sixth game in a row.

OVERTURNED

Miami's DeVante Parker made a diving catch for 46 yards to set up a touchdown. He had a leaping 32-yard reception and a 10-yard touchdown catch wiped out by replay review reversals.

Parker went to the locker room with a back injury late in the third quarter.

"His lower back kind of locked up on him," Gase said.

OTHER INJURIES

Niners LB Shayne Skov (knee) and WT Quinton Patton (concussion) left with injuries, as did Miami DE Mario Williams (illness) and CB Lafayette Pitts (back). ... The Dolphins played without left tackle Branden Albert (left wrist), left guard Laremy Tunsil (shoulder) and center Mike Pouncey (hip). All were inactive.

UP NEXT

49ers: Visit the lowly Chicago Bears next Sunday.

Dolphins: Visit the Baltimore Ravens next Sunday in a matchup of playoff contenders.