It's a hefty deal for a third-line centre coming off a career season in which he finished fifth on the Sabres with 63 points (21-42) in 75 games. He was also a plus-37 - fifth-best among all NHL skaters.
The deal will pay him $4 million on average per season, a significant raise for Roy, who made $627,000 last year.
"Derek is a solid young player who will only continue to improve," general manager Darcy Regier said in a statement. "He will play an increased role for our club, and we look forward to having such a quality player in our organization for many years to come."
The deal was announced shortly before Roy was scheduled to have an arbitration hearing in Toronto.
Buffalo's second-round pick in the 2001 draft, Roy blossomed in his third year with the Sabres last season while centering a line featuring high-scoring wingers Thomas Vanek and Maxim Afinogenov.
Roy is being counted on to play an even bigger role after the Presidents' Trophy-winning Sabres lost co-captains Chris Drury and Daniel Briere to free agency on July 1.
The length of the contract is a major departure for the Sabres, who previously were against signing players to deals beyond four years. The Sabres philosophy is changing after they were unable to retain Drury and Briere.
Buffalo was also forced into re-signing Vanek to a $50-million, seven-year contract this month by matching an offer sheet presented to him by the Edmonton Oilers.
After scoring 15 of his 21 goals in the second half of last season, Roy's production tapered off in the playoffs. He managed two goals and five assists in 16 post-season games before the Sabres were eliminated by Ottawa after reaching the Eastern Conference final for a second straight season.