The versatile defender, who was named Boro's Player of the Year last term, had been linked with a host of Premier League and Championship clubs, but has now committed himself to the team that he "loves".
Friend told the club's official website: "I don't like cliches, but when it comes down to it, I really love this club and I'm delighted that I can dedicate myself for the longer-term.
"It's been a great move for me, coming here. I couldn't be much further from where I was born, but I feel so at home here. There's a number of reasons for that - my team-mates, a manager I admire and respect, the coaches, the physios, the staff, the chairman for all that he does, and the big part, the fans.
"The fans have been good to me and supported me, and they've made me feel so welcome. I appreciate what it takes for them to get a ticket for a game and to support us the way they do, and I try and work as hard as I can on the pitch and in training, and by giving something back in the community."
Friend, 26, has made 85 appearances for the Riverside Stadium outfit since joining from Doncaster Rovers in 2012.