Prince Andrew, 61, will also stop using the style His Royal Highness in an official capacity, a royal source said.
It comes as he faces a US civil action over sexual assault allegations - claims he has consistently denied.
A source close to the duke said he would "continue to defend himself" against the case brought in New York by Virginia Giuffre.
But the source insisted a judge's ruling on Wednesday that the civil action could proceed was "not a judgement on the merits of Ms Giuffre's allegations".
Buckingham Palace said in a statement: "With the Queen's approval and agreement, the Duke of York's military affiliations and Royal patronages have been returned to the Queen.
"The Duke of York will continue not to undertake any public duties and is defending this case as a private citizen."
All Prince Andrew's roles have been returned to the Queen with immediate effect, and will be redistributed to other members of the Royal Family, a source said.
The issue had been widely discussed with the Royal Family, the source said.
Like Harry and Meghan, Prince Andrew retains his title HRH but will not use it in any official capacity.
A spokesperson for the Ministry of Defence said it had no comment about the duke's military titles being handed back to the Queen, and that it was a matter for the Palace.
On Thursday, a letter - released by anti-monarchy pressure group Republic - was signed by more than 150 Royal Navy, RAF and Army veterans asking the Queen to strip Prince Andrew of his eight British military titles.
Lt Stuart Hunt, who served in The 1st Royal Tank Regiment and signed the letter, welcomed the prince losing his military titles but suggested the matter should have been resolved sooner.
The 52-year-old told the PA News Agency: "It's an unsavoury business... I'm just glad he's not associated with the military now.
"Whether he's guilty or not, he has brought things into disrepute... He's not fit to serve in an honorary rank. He has forgone that right by getting into this sort of situation."