In a statement on Tuesday, Buckingham Palace said the duke was discharged “following treatment for an infection and a successful procedure for a pre-existing condition”.
“His Royal Highness wishes to thank all the medical staff who looked after him… and everyone who has sent their good wishes,” the statement said.
Prince Philip and the Queen, 94, have spent the most-recent lockdown in England living at Windsor with a small group of household staff, nicknamed HMS Bubble.
The couple, who have been married for 73 years, received their first Covid-19 jabs in January.
The exact reason for his initial admission was not disclosed, but the Palace said at the time it was not related to coronavirus.
The hospital is a private clinic in central London which has treated the Queen on several occasions as well as the duke and other senior royals.
Prince Philip left through a side entrance of the hospital in a wheelchair and was helped into the rear passenger seat of a waiting car.
Members of the Royal Family continued with their official duties while the duke was in hospital.
Prince Philip’s hospital stay coincided with the Duke and Duchess of Sussex’s interview with Oprah Winfrey, in which allegations of racism and a lack of mental health support were levelled at the Royal Family.
Buckingham Palace said in a statement afterwards that the issues were concerning, and while “some recollections may vary”, the matter was a family one that will be dealt with privately.
In the interview, Meghan told Oprah that she phoned the monarch directly “just to check in” after hearing the duke had been taken to hospital.