The new deal will keep the highly-rated winger at Old Trafford until the summer of 2018.
United boss David Moyes said: "I'm really pleased Nani has re-signed for the next five years. He has great ability and experience beyond his 26 years.
"I've been impressed with his approach to training and look forward to working with him in the coming seasons."
Nani said: "Playing at United has been a fantastic experience for me. When I came to the Club, I never imagined the success we have enjoyed.
"Training every day with top players who want to win trophies every year is a great motivation to me.
"I'm very happy that the new manager has shown this faith in me and I'm looking forward to helping the team compete for more honours this season."