A Conservative leadership race will take place this summer and a new prime minister will be in place in time for the Tory party conference in October.
Johnson publicly announced his resignation outside No 10 Downing Street just after 11.30pm New Zealand time.
He said it was "clearly now the will of the parliamentary party" for there to be a new prime minister.
"I want you to know how sad I am to be giving up the best job in the world," Johnson said.
"But them's the breaks."
Johnson said his arguments to stay in power were rejected due to a "herd instinct" at Westminster.
He said it had been "an immense privilege" to hold the top job but no one in politics was "remotely indispensable".
He was immensely proud of his achievements, including getting Brexit done, getting the UK through the pandemic and leading the West in standing up to Russia's President Vladimir Putin's invasion of Ukraine.
Johnson promised to give the new leader as much support as he could.
He rejected any idea of holding a general election, saying it would be preposterous to change governments when the administration was delivering so much and "when the economic scene is so difficult domestically and internationally".
The process of choosing a new Conservative leader would begin immediately with a timetable to be announced next week.
Before Johnson made his address, Tories were already questioning whether he could stay on as prime minister in the meantime with some suggesting his deputy Dominic Raab take over as a caretaker. Other British political figures also weighed in on the issue, insisting Johnson's tenure was now untenable.
Labour Party leader Sir Keir Starmer demanded Johnson stand down as PM immediately, saying it was not fair on the country for him to stay on as caretaker prime minister.
"He needs to go, he can't cling on," Starmer said.
"His own party has decided it's time - so they can't inflict him on the country for the next few months."
Insisting Labour will take matters into its own hands if necessary, Starmer warned the Tories that if they did not get rid of Johnson "Labour will, in the national interest, bring a no confidence vote - because this can't go on".
"The change we need is not just at the top, we need a change of government. We need a Labour government."
Starmer said the Tory party had inflicted chaos upon the country during the worst cost-of-living crisis in decades. And they cannot now pretend they are the ones to sort it out.
"They have been in power for 12 years. The damage they have done is profound."
Foreign Secretary Liz Truss, who is one of the front runners to replace Johnson, tweeted that Johnson had made the right decision.