The agreement is the second-largest contract for a major league pitcher. CC Sabathia signed with the New York Yankees for $161 million in a seven-year deal reached in 2008.
The deal with the Phillies links Hamels, a left-handed starter, to the team through the 2018 season and includes a club option for 2019 with a limited no-trade clause.
Hamels is in his seventh season -- all with Philadelphia -- in the major leagues. He is 11-4 with a 3.23 earned run average this season and 85-58 with a 3.38 ERA over his career. He has been selected to the National League All-Star team three times, including 2011 and 2012.
Hamels, 28, was the most valuable player in both the National League Championship Series and World Series in 2008.
He could have become a free agent at the end of this season.
"Our goal remains the same, to try to put pieces around these core players to remain a championship-caliber club," said Philadelphia General Manager Ruben Amaro.
Beyonce flaunts bikini body, Blue Ivy in vacation pics
Gal Gadot cast as Wonder Woman for 'Batman vs. Superman'