Hartnell is coming off his best season, scoring a career-high 37 goals. He was second on the Flyers with 67 points.
The deal announced Monday is reportedly worth $28.5 million over six years.
"I'm very happy to be staying in Philly to continue my career playing in front of the best fans in the NHL," Hartnell said.
Hartnell has 222 goals and 252 assists in 11 seasons with Nashville and Philadelphia. He has also recorded 19 goals and 25 assists in 84 career playoff games.
Stay Connected
NHL.TV™
NHL GameCenter LIVE™ is now NHL.TV™.
Watch out-of-market games and replays with an all new redesigned media player, mobile and connected device apps.
Introducing the new official NHL App, available for iPhone, iPad and Android smartphones and tablets. A host of new features and improved functionality are available across all platforms, including a redesigned league-wide scoreboard, expanded news coverage, searchable video highlights, individual team experiences* and more. The new NHL App on your tablet also introduces new offerings such as 60fps video, Multitasking** and Picture-in-Picture.
*Available only for smartphones
** Available only for suported iPads