The 26-year-old defenseman, a restricted free agent, avoided an arbitration hearing scheduled for Sunday.
"MacKenzie is a solid two-way competitor who brings tenacity and skill to our lineup," general manager Bill Zito said. "He has developed into a key member of the Panthers both on and off the ice and we look forward to him taking the next step in his career."
Weegar had NHL career highs in goals (seven), points (18), plus/minus rating (plus-6) and average time on ice (20:07) in 45 games last season. He had one assist in four games during Florida's loss to the New York Islanders in the best-of-5 Stanley Cup Qualifiers.
The Ottawa native was selected by the Panthers in the seventh round (No. 206) of the 2013 NHL Draft and made his NHL debut against the Montreal Canadiens on April 3, 2017. He has scored 41 points (13 goals, 28 assists) in 172 NHL games, all with Florida.