The Duke of Edinburgh — who will turn 100 in June — stayed at the hospital for almost 28 days, his longest stay ever.
"The Duke of Edinburgh has today been discharged from King Edward VII's Hospital and has returned to Windsor Castle, following treatment for an infection and a successful procedure for a pre-existing condition," Buckingham Palace said in a statement.
"His Royal Highness wishes to thank all the medical staff who looked after him at both King Edward VII's Hospital and St Bartholomew's Hospital, and everyone who has sent their good wishes," they added.
In February, Philip was admitted to the hospital since he wasn't feeling well. Shortly after, the Palace revealed he was being "treated for an infection."
"His Royal Highness The Duke of Edinburgh was admitted to the King Edward VII Hospital in London, on Tuesday evening," the statement from Buckingham Palace said at the time. "The Duke's admission is a precautionary measure, on the advice of His Royal Highness's Doctor, after feeling unwell."
In March, the palace said Philip was being "transferred from King Edward VII’s Hospital to St Bartholomew’s Hospital where doctors will continue to treat him for an infection, as well as undertake testing and observation for a pre-existing heart condition."
“The Duke remains comfortable and is responding to treatment but is expected to remain in hospital until at least the end of the week,” they added.
While Philip remained away from home, Queen Elizabeth II has been dealing with the aftermath of Prince Harry and Meghan Markle's Oprah Winfrey interview. During their chat, the couple claimed someone in the royal family was "concerned" over Archie's skin color.
A few days later, the Palace addressed the accusations.
“The following statement is issued by Buckingham Palace on behalf of Her Majesty the Queen,” the statement, which was shared on social media on Tuesday, March 9, began.
“The whole family is saddened to learn the full extent of how challenging the last few years have been for Meghan and Harry. The issues raised, particularly that of race, are concerning. Whilst some recollections may vary, they are taken very seriously and will be addressed by the family privately. Harry, Meghan and Archie will always be much loved family members.”