The 23-year-old was due to be a restricted free agent after the season. McAvoy is in the final year of a three-year bridge deal that paid him $4.9 million annually and is now getting the biggest deal in Bruins franchise history.
The $9.5 million average annual value on McAvoy's deal is in line with the massive contracts awarded during the offseason to several NHL defensemen, including the Colorado Avalanche's Cale Makar (six years, $9 million AAV), the Dallas Stars' Miro Heiskanen (eight years, $8.45 million AAV), the Chicago Blackhawks' Seth Jones (eight years, $9.5 million AAV), the Columbus Blue Jackets' Zach Werenski (six years, $9.58 million AAV) and the New Jersey Devils' Dougie Hamilton (seven years, $9 million AAV).
And McAvoy has plans for how he will use some of his newfound money.
"I might go get my dog a handful of bones," McAvoy said, adding, "It's such a whirlwind. Now I just get to do what I love, which is play hockey, and there's no stress around that. Just getting to come to work every day and do what I love."
After beginning his career paired with Zdeno Chara, McAvoy inherited the true No. 1 defenseman role last season. He led all Bruins skaters in ice time (23 minutes, 59 seconds per game) while tallying five goals and 25 assists in 51 games. McAvoy finished fifth in Norris Trophy voting.
"We think highly of him both as a player and as a person," Sweeney told reporters earlier this week. "He's growing into a leadership role, he's been included in that leadership group, and hopefully that's an indication that Charlie's grown into the person, both as a leader and as a player, that we all hoped he would be."
McAvoy, who played at Boston University, was selected by the Bruins with the No. 14 overall pick of the 2016 NHL draft. The Long Beach, New York, native is expected to be part of the blue line for Team USA at the 2022 Olympics in Beijing.
"There's no place I'd rather be," McAvoy said. "I've wanted to be in Boston since the moment I've been here. It's been a dream to come to BU and be able to stay here. It's just been such a dream to get to this point. I can't be happier than I am right now."
Bruins coach Bruce Cassidy said McAvoy was "just a great story for us as an organization."
"He's part of the core now and going forward," Cassidy said. "For a coach, it's great. He works hard, trying to get better. He's growing into a leader, I think this helps him in that department."
Cassidy said the biggest concern is that McAvoy might put too much pressure on himself because of the "big ticket."
"The one thing that does happen sometimes," the coach said. "So he's just got to be careful, just go out and play, be the same Charlie McAvoy you've always been, keep getting better. That's the only discussion I'll probably have with Charlie at some point."
The Bruins open their season Saturday at home against the Stars. Cassidy said 22-year-old Jeremy Swayman will start in goal over veteran Linus Ullmark. Longtime goalie Tuukka Rask is unsigned but says he wants to return when he recovers from hip surgery.
The Associated Press contributed to this report.