The Duke of Edinburgh left the King Edward VII hospital after spending five nights with complaints of bladder infection.
The Duke will celebrate the 91 birthday on Sunday and would be attending the Queen's jubilee garden party at the Sandringham Estate on Tuesday.
On Wednesday, the Queen and the Duke of York visited Prince Philip. He was also visited by the Earl and Countess of Wessex and their children, Louise and James.
Andrew said his father was "mending very well'.
Philip fell ill and was taken to the hospital from the Windsor Castle on Monday after he spent a day attending the river jubilee pageant at the Thames.
He missed the rest of the celebrations including the thanksgiving service at the St Paul's Cathedral and the concert outside Buckingham Palace. Over a million people gathered for the palace concert on Monday night featuring Paul McCartney, Kylie Minogue and Stevie Wonder.
While speaking on the occasion of the jubilee concert, Prince Charles said: "The only sad thing about this evening is that my father cannot be her with us because unfortunately he's taken unwell."
Earlier, Buckingham Palace announced that the duke's condition improved considerably and he was in good spirits.
On Friday, the Duke of Cambridge and Prince Harry visited their grandfather at the hospital. The princes left after 20 minutes and did not speak to reporters.
Clarence House said the princes paid a "short private visit" to their grandfather just before 5 pm on Friday.
The King's Troop Royal Horse Artillery is expected to fire a salute in London's Hyde Park on the occasion of Philip's birthday, a regular feature every year.
To contact the editor, e-mail: