Pepe, 33, has enjoyed an impressive year for both club and country, helping Real to an 11th European crown in May, before playing a major role in Portugal's victory at Euro 2016 during the summer.
The former Porto defender has been with Los Blancos since the summer of 2007, but has been heavily linked with a move to United and Chelsea as he has yet to pen a new deal at the Bernabeu.
However he has now confirmed that he wants to commit his future to Real and end his career with Zinedine Zidane's side.
"My plan is to retire at Real Madrid," he said. I'm 33 years old, and last season was one of my best ever. It will be what the club wants."
Pepe's current deal is due to expire at the end of the current campaign, but he insists it will be ultimately up to the club if they want to keep him beyond the end of the season.
He added: "My renewal is in Real's hands. I will wait for the club until the last second of my contract."
Man United last week