Josh Allen threw a go-ahead, 5-yard touchdown pass to Stefon Diggs late in the first half and Buffalo beat the Cleveland Browns 31-23 on Sunday after the NFL moved the Bills’ home game due to several feet of snow blanketing western New York.

The Bills (7-3) avoided blowing a third straight halftime lead by scoring on all five of their possessions in the second half and doing a better job protecting the ball.

Perhaps escaping snow-packed homes — with the help of Bills employees, friends and strangers — will prove to be pivotal for a Super Bowl-contending team that was in a relative slump.

“When you go through a shared experience like this, it can bring a team closer together,” coach Sean McDermott said.

Cleveland (3-7) rallied within eight points, setting up an onside kick in the final seconds that Bills receiver Gabe Davis failed to grab and running back Taiwan Jones knocked out of bounds.

“We’re in search of a win and which way we can get it,” coach Kevin Stefanski said. “I know these guys are putting in the effort. We just have to finish football games, and it’s really frustrating.”