Hayes made $3.75 million annually on his last contract.
The Flyers acquired the negotiating rights for Hayes from the Winnipeg Jets on June 3 for Philadelphia's fifth-round pick in this week's NHL draft. Hayes had a career-high 55 points (19 goals, 36 assists) in 71 games between the Jets and the New York Rangers last season.
The 6-foot-5 Hayes was drafted by the Chicago Blackhawks at No. 24 overall in 2010, but he never played for them. He signed as a free agent with the Rangers in 2014, and he played five seasons with the Blueshirts before a deadline trade to Winnipeg.
In 381 career games, Hayes has 92 goals and 137 assists.
The trade reunites him with coach Alain Vigneault, who was behind the Rangers' bench for four of Hayes' five years in New York. The Flyers named Vigneault head coach in April.
Hayes is known as a versatile forward, playing both center and wing. But in speaking about him before the signing, Flyers general manager Chuck Fletcher appeared to cast him as a center.
"You need depth as we're seeing now in the Stanley Cup Final," he said. "You need players that can play. You certainly need all four lines to contribute, but you need certainly three lines that can score and defend.
"When you go on the road, you don't have last change, so several centers that can be on the ice for the faceoff and to not worry about it. They can defend that shift. They can compete that shift. They have a chance to if not win that shift, at least tie it and live to fight another day. That's our goal. Depth is everything."
Fletcher has been the busiest GM of the offseason. Along with agreeing to a deal with Hayes, Fletcher traded defenseman Radko Gudas to the Washington Capitals for defenseman Matt Niskanen and he traded two draft picks to the San Jose Sharks for defenseman Justin Braun.