O'Reilly led the team with a career-high 28 goals last season and won the Lady Byng Memorial Trophy, which is awarded to a player who best exemplifies gentlemanly conduct. He also had six game-winners as the Avalanche advanced to the playoffs for the first time since 2009-10 under first-year coach Patrick Roy.
"We are pleased to have Ryan under contract," Avalanche executive vice president of hockey operations Joe Sakic said. "We are looking at the upcoming training camp and season with a lot of excitement."
The contract contains an average cap hit of $6 million -- $5.8 million in the first year and $6.2 million in the second, a source told ESPN.com's Scott Burnside.
The Avalanche made it an offseason priority to lock up the 23-year-old O'Reilly, but the two sides were far apart on numbers and appeared headed toward arbitration.
Colorado selected O'Reilly in the second round of the 2009 draft.
The Associated Press contributed to this report.