The Serbia international looked to be on his way out of United last season when he lost his place, but a resurgence in form has seen him reclaim his place and earn a new deal.
Matic said: “I am very happy that I will continue to be part of this great club. As a player, I still have a lot more to give and achieve in my career and to do that with Manchester United will be a huge honour.
"This is a really exciting team to be part of, we have a good balance of youth and experience within the squad and there is great comradery amongst the group.
"This is a key part of the season and we are playing well. We will continue to fight to finish the season on a high and make our amazing supporters proud."
United boss Ole Gunnar Solskjaer said: “I am delighted that Nemanja has signed a new contract, I know his experience, professionalism and leadership will be invaluable to this young talented group.
"We have great strength in midfield and Nemanja's attributes are a key part of that. Nemanja has been here for three seasons now and really understands the values of playing for Manchester United.
"He remains hugely ambitious and determined which will be vital as we look to achieve our aims over the coming years."