In a video posted to Twitter Friday, the 55-year-old conservative leader said he was tested after showing mild symptoms, including a cough.
Johnson said he is self-isolating and continuing to lead the country's response to COVID-19.
"We will get through it, and the way we're going to get through it is, of course, by applying the measures that you have heard so much about," he said.
His tweet included the hashtag #StayHomeSaveLives.
Over the last 24 hours I have developed mild symptoms and tested positive for coronavirus.— Boris Johnson #StayHomeSaveLives (@BorisJohnson) March 27, 2020
I am now self-isolating, but I will continue to lead the government’s response via video-conference as we fight this virus.
Together we will beat this. #StayHomeSaveLives pic.twitter.com/9Te6aFP0Ri
Johnson is the highest-profile political leader to have contracted the virus, which has infected more than 500,000 people around the world.
He has been criticized by his opponents for the government's initial reluctance to impose tough restrictions on movement and the economy to try to stem the spread of the virus. Early this month, Johnson recounted shaking hands with medics treating coronavirus patients at a hospital and said "I continue to shake hands."
This news comes as Britain's Prince Charles announced that he had tested positive for the virus.
The 71-year-old heir to the British throne is showing mild symptoms of COVID-19 and is self-isolating at a royal estate in Scotland, his Clarence House office said.
More than 11,500 COVID-19 cases have been confirmed in the United Kingdom.
The Associated Press contributed to this report.