Prince Philip, 98, was taken to the King Edward VII's Hospital in London on Friday on the advice of his doctor.
Buckingham Palace said the duke had returned to the Queen's Sandringham Estate in Norfolk on Tuesday and thanked people for "their good wishes".
It comes after the revelation the Queen will use her Christmas Day message to acknowledge 2019 has been "bumpy".
The monarch herself travelled to Sandringham on Friday.
The palace, meanwhile, said the duke's hospital admission had been a "precautionary measure".
Prince Philip retired from public life in August 2017 after decades supporting the Queen and attending events for his own charities and organisations.
His last public appearance was Lady Gabriella Windsor's wedding in May.
The Prince of Wales said on Monday his father had been "looked after very well" by hospital staff.
But Charles, who was visiting flood-hit communities in South Yorkshire, added: "When you get to that age things don't work so well."
Royal commentator Caroline Aston told the BBC it was "entirely in keeping with the man" for Prince Philip to have seemingly had no visitors during his hospital stay, because he likes to make "no fuss about anything".
The Queen, 93, recorded her annual Christmas Day message before Prince Philip was admitted to hospital.
In the message, to be broadcast on BBC One at 15:00 GMT on Christmas Day, the monarch will say the path is never "smooth" but "small steps" can heal divisions.
After a year of intense political debate over Brexit, as well as a number of personal events affecting the Royal Family, the Queen will say: "Small steps taken in faith and in hope can overcome long-held differences and deep-seated divisions to bring harmony and understanding."
In January, the Duke of Edinburgh was involved in a car crash while driving near Sandringham. He escaped uninjured, but two women required hospital treatment.
In September, the Duke and Duchess of Sussex publicly revealed their struggles under the media spotlight during their tour of southern Africa.
And last month, the Duke of York withdrew from public life after a BBC interview about his ties to sex offender Jeffrey Epstein, who killed himself in August.