Johnson, 55, was taken to St Thomas' Hospital in central London on April 5, suffering from persistent symptoms of the disease caused by the new coronavirus. On April 6 he was moved into intensive care, where he remained until April 9.
"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," an official statement said.
In his first comments since leaving intensive care, Johnson said he owed his life to hospital staff.
"I can't thank them enough. I owe them my life," he said in comments that were released to journalists and confirmed by his office on Sunday.
His pregnant fiancee, Carrie Symonds, who has also suffered from COVID-19 symptoms, thanked National Health Service staff in a series of tweets shortly after the Downing Street statement on Johnson being discharged.
"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," she said.
While Johnson has been out of action, his ministers have come under mounting pressure to explain why the national death toll is rising so fast.
Britain has reported two days in a row of hospital deaths increasing by more than 900 people. Friday's death toll of 980 surpassed the highest recorded in a single day in Italy, the hardest hit country in Europe so far.
The British government has had to defend its response, which has included carrying out far less testing than in some other European countries and ordering a lockdown that came comparatively late. Ministers have also resisted apologising for a shortage of protective gear for hospital staff.
In a sign of the gravity of the emergency, Queen Elizabeth issued her second rallying message in a week, telling the nation that "coronavirus will not overcome us".