Jets-Bills just got a lot more interesting.

After six years as Jets coach, Rex Ryan will agree to become Buffalo's coach, sources told Newsday. He reportedly will get a five-year deal worth about $5.5 million annually.

The Bills reportedly will hire 49ers offensive coordinator Greg Roman to serve in the same capacity. And according to sources, Ryan will take former Jets defensive coordinator Dennis Thurman and Jets defensive assistant Jeff Weeks -- his former college roommate -- with him.

Ryan went 46-50 during the regular season with the Jets and failed to make the playoffs the past four seasons, but he was a hot commodity after being fired by owner Woody Johnson on Dec. 29 along with general manager John Idzik. Besides the Bills, Ryan drew interest from the 49ers, Falcons and TV networks.

Ryan apparently had his sights set on becoming Atlanta's coach. According to sources, he had hoped his second interview with Bills owners Terry and Kim Pegula on Saturday night would spur the Falcons into action. But that didn't happen.

Instead, the Bills "made him feel wanted,'' one source said.

Ryan will be the first since Bill Parcells to be the head coach of teams in the same division in consecutive seasons. The Jets will have to face their former coach twice a year.

The Falcons appeared to be the perfect landing spot for Ryan. They have a standout quarterback in Matt Ryan and big-time wide receivers, and they play in the weak NFC South.

In joining the Bills, Ryan has inherited a situation similar to the one he left behind. The Bills have a very good defense but don't have a first-round pick in the 2015 draft. There also are a lot of questions at quarterback.

First-round pick EJ Manuel was benched in favor of journeyman Kyle Orton during the season by former Bills coach Doug Marrone, who opted out of his contract on New Year's Eve and later interviewed for the Jets' coaching job. But after Orton surprisingly announced his retirement after the season, the Bills likely will be forced to turn back to Manuel in 2015.

Ryan is no stranger to coaching young quarterbacks. As a rookie head coach, he helped the Jets reach the AFC Championship Game after the 2009 season with a rookie quarterback in Mark Sanchez. The following season, the Jets also reached the conference title game. But they struggled during the next two seasons with Sanchez, finishing 8-8 and 6-10, and a change in quarterback did little to help. With Geno Smith -- who was selected 23 spots after Manuel in the 2013 draft -- the Jets finished 8-8 and 4-12 the past two seasons.

The Bills went 9-7, their best record since 2004, but missed the playoffs for the 15th consecutive year.

There's also the question of whether more Jets assistants will join Ryan in Buffalo or if Bills assistants will defect to other teams. Bills defensive line coach Pepper Johnson is scheduled to interview with the Giants on Monday. The Giants also are interested in interviewing Bills defensive coordinator Jim Schwartz.