The defending Stanley Cup champions and the Flyers announced the deal Tuesday.
Gagne hasn't scored a goal in 11 games this season, his second with Los Angeles. The seven-time 20-goal scorer has been a healthy scratch recently.
Gagne missed several months with his latest concussion last season for the Kings, but returned in the Stanley Cup finals and contributed to the Kings' first championship.
Gagne spent his first 10 NHL seasons with Philadelphia, scoring a career-high 47 goals during the 2005-06 season. The Flyers traded him to Tampa Bay in 2010, and the Kings signed him a year later.
He will be a free agent this summer.