Doug Marrone has agreed to leave Syracuse and become the coach of the Buffalo Bills, league sources told ESPN on Sunday.

Marrone will replace Chan Gailey, who was fired after going 16-32 in three seasons leading the Bills. Marrone agreed to a four-year contract but has yet to sign the deal, a league sources told ESPN.

Marrone takes over a Bills team that has not had a winning record since 2004, when it finished 9-7, and has missed the playoffs for 13 straight seasons -- the NFL's longest active drought.

The 48-year-old Marrone went 25-25 in four seasons at Syracuse, turning around a program that had gone 26-57 in the previous seven years.

Syracuse rolled to an 8-5 finish by winning six of its last seven games this past season, including a 38-14 win over West Virginia in the New Era Pinstripe Bowl.

The Orange offered congratulations to Marrone on his new job with a tweet Monday.

"#OrangeNation wishes head coach Doug Marrone all the best in NFL with the Bills. Thanks for what you've done at the 'Cuse," the school posted on its Twitter account.

The Syracuse job was Marrone's first as a head coach. He has seven years of NFL experience. Marrone spent 2006-08 as the New Orleans Saints' offensive coordinator and was the New York Jets' offensive line coach from 2002-05.