Shawn Bryson had 107 of Buffalo's season-best 192 rushing yards as the Bills improved the AFC's worst record to 3-12.
"I thought we were going to try to find another way to let one slip away there, and we didn't let that happen," Bills quarterback Alex Van Pelt said. "Maybe that's a really big step for this team."
New York had possession twice in the final two minutes, but fell short of its fifth fourth-quarter comeback of the season. Vinny Testaverde's rushed pass as time expired went out of the end zone.
"It's a tough one, disappointing," Testaverde said. "We work hard all year to get in this position. We didn't play well enough. We didn't do the things we needed to do."
The Jets (9-6) could have clinched a playoff spot with a win Sunday and could have won the AFC East by closing the season with two victories. Even after their loss, they could have grabbed a wild card berth later in the day if San Diego had beaten Seattle.
But the Seahawks downed the Chargers on a 54-yard field goal on the final play of the game, leaving the Jets having to wait a week before finding out their playoff fate. If they lose to Oakland on the road next week, the Jets could be eliminated.
"We controlled our own destiny," safety Victor Green said. "We let it slip through our fingertips. We let them hang around and they found a way to win."
Along with fourth-quarter comebacks, New York had gotten used to controlling the turnover battle, holding a plus-23 ratio before committing three of the game's four turnovers Sunday.
The Jets had an interception in the end zone and fumbled a kick return.
"That's uncharacteristic of us," Coach Herman Edwards said. "That was a team loss."
The Bills, who will have one of the top-five picks in next year's draft, were coming off consecutive three-point losses. They have six losses of seven points or fewer.
"We should have won last week and the week before," wideout Peerless Price said. "We deserved to win this game."
The Bills also improved to 1-6 against AFC East opponents.
"I'm not happy that it took us until after Christmas, but we got a division win," Hansen said. "It's nice to be a big part of winning a football game."
Buffalo grabbed a 14-6 lead 3:43 into the second half following touchdown drives of 87 and 80 yards.
The Jets then had a drive stall at the Bills' 15-yard line before settling for a 32-yard field goal from John Hall to get within 14-9 with 12:36 left.
They drove to Buffalo's 35 on their next possession when Testaverde dropped back on second and 10 and threw it to Hansen.
Hansen, the most-tenured Bills player at 12 years, returned the interception 17 yards.
"I saw Vinny fade back and recognized the screen," Hansen said. "I got my hand up and deflected it. It was kind of lucky."
Buffalo failed to get a first down on the ensuing possession and when punter Brian Moorman could not handle a shorthopped snap, New York took over at midfield.
Punting was a horror show for the Bills as Moorman netted 20 yards on his last five kicks.
With no timeouts remaining, the Jets needed to go 50 yards in 47 seconds. But with 13 seconds remaining, Testaverde threw short over the middle to Curtis Martin for a seven-yard gain as the clock continued to run.
"We had five other receivers, but the coverage dictated we go to Curtis on that play," Testaverde said.
The Jets barely got off another snap as Testaverde overthrew the right side of the end zone as time expired.
Testaverde completed 20 of 38 passes for 235 yards with two interceptions for New York, which won its previous two games on the late touchdown drives.
One of Testaverde's interceptions was by rookie Nate Clements, who snatched a jumpball from Kevin Swayne in the end zone early in the second quarter.
Martin had 115 yards on 19 carries, but Buffalo controlled the ground game behind Bryson, who became the first Bill to have consecutive 100-yard games since Thurman Thomas in 1996.
"I thought Shawn Bryson ran the ball tough," Bills coach Gregg Williams said.
With Bryson chewing up yardage, the Bills were able to mix it up offensively.
Van Pelt completed four passes of at least 15 yards during an 11-play, 87-yard drive that Larry Centers capped with a five-yard run, making it 7-6 with 19 seconds left in the first half.
On the first possession of the second half, the Bills went 80 yards in eight plays. Van Pelt threw a 22-yard touchdown pass to Price after Price had raced 28 yards on an endaround.
Craig Yeast fumbled the ensuing kick return.
"I thought a couple of keys were, at the end of the half we established momentum," Williams said. "At the start of the second, we received the ball and put a scoring drive right away."
Van Pelt went 16 of 27 for 185 yards. Tight end Jay Riemersma finished with a career-high eight catches for 78 yards for the Bills.
Hall accounted for New York's points with field goals of 33, 28 and 32 yards. Laveranues Coles finished with seven receptions for 99 yards.