Mr Johnson, 55, was taken to London’s St Thomas’ Hospital on Sunday – 10 days after testing positive for Covid-19.
He spent three nights in intensive care before returning to a ward on Thursday.
He said in a video on Twitter that he had witnessed the “personal courage” of hospital staff on the front line.
Mr Johnson said two nurses – Jenny from New Zealand and Luis from Portugal – stood by his bedside for 48 hours at the most critical time and named several other hospital workers who cared for him this past week that he wanted to thank.
He said NHS workers “kept putting themselves in harm’s way, kept risking this deadly virus”.
“It is thanks to that courage, that devotion, that duty and that love that our NHS has been unbeatable,” he said.
Downing Street said the PM would continue his recovery at his country residence, Chequers.
“On the advice of his medical team, the PM will not be immediately returning to work. He wishes to thank everybody at St Thomas’ for the brilliant care he has received.
“All of his thoughts are with those affected by this illness.”
The UK has recorded 737 new coronavirus-related hospital deaths as of 17:00 BST on Saturday, taking the total number to 10,612.
Health Secretary Matt Hancock said he was “delighted” the PM was out of hospital and continuing his recovery at Chequers.
He added that staff at St Thomas’ would “have cared for him as they would have cared for anybody in this country,” which was “one of the things that makes me so proud that the NHS is there for us all”.
Asked how long it would be before the prime minister returned to work, he said: “That will be a clinical decision for his doctors to take with him.
“The government is operating perfectly efficiently within the strategy he set out.”
Foreign Secretary Dominic Raab is currently in charge of running the government, with aides reportedly expecting Mr Johnson to be out of action for as long as a month.
Dr Ian Abbs, chief executive at Guy’s and St Thomas’ hospital, said: “It is a great credit to the exceptional professionalism of clinical teams, as well as everyone in the wider organisation, that we have been able to care for the prime minister so effectively, whilst continuing to deliver equally high standards of care to all of our patients.
“While it is right that we celebrate this good news, our thoughts turn immediately to those who still need our help at this time.
“On behalf of everyone at Guy’s and St Thomas’, I’d ask that people stay home to help us save lives and protect the NHS.”
The prime minister’s fiancee, Carrie Symonds, who is due to give birth in two months, said on Twitter: “Thank you also to everyone who sent such kind messages of support. Today I’m feeling incredibly lucky.
“There were times last week that were very dark indeed. My heart goes out to all those in similar situations, worried sick about their loved ones.
“I cannot thank our magnificent NHS enough. The staff at St Thomas’ Hospital have been incredible. I will never, ever be able to repay you and I will never stop thanking you.”
Ms Symonds has been self-isolating with coronavirus-like symptoms but has not been tested.
Relief for many as Johnson is discharged from hospital
Even before we heard that Boris Johnson had been discharged from hospital it was clear the prime minister would not be rushing back to work.
And his fiancée Carrie Symonds’ tweet – which refers to “dark” times last week – is a further sign of how unwell he’s been.
So, for now, Foreign Secretary Dominic Raab will continue to deputise. But the extent to which Boris Johnson may want to feed into any upcoming decisions – while not being fully back at work – isn’t yet known.
Much may depend on the advice of his doctors. But the fact that the man who was elected to run the country is out of hospital will see many feel relieved. Like or loathe his politics.
Agree or disagree with the way the coronavirus outbreak has been handled so far, Boris Johnson is the elected prime minister and political authority ultimately rests with that office. And authority will likely be what’s needed when big decisions lie ahead.