The deal contains a maximum value of $57 million, which Thompson will make if he hits all of his incentives over the life of the deal.
"Shaq is our type of person and our type of player," Panthers general manager Marty Hurney said in a release. "He's proven that he can play linebacker at a very high level, and he's got all the traits you want. He's smart, he's physical, he can run, and he's very versatile. He fits the blueprint for what we want at the position."
A first-round pick of the Panthers in 2015, Thompson has amassed a career-high 93 tackles this season, along with three sacks and three pass breakups. He and Luke Kuechly give Carolina one of the top linebacker tandems in the NFL.
Thompson, 25, was on track to hit free agency in March 2020. His extension comes at a fascinating time for the Panthers, who fired head coach Ron Rivera on Tuesday.