Matt Hancock has resigned as health secretary after he breached social distancing guidance by kissing a colleague.
In a letter to the PM he said the government “owe it to people who have sacrificed so much in this pandemic to be honest when we have let them down”.
Boris Johnson said he was “sorry” to receive the resignation.
Former chancellor Sajid Javid has said he is “honoured” to have been chosen as Mr Hancock’s replacement.
Mr Hancock had been under increasing pressure to quit, after the Sun published pictures and then a video of Mr Hancock and Gina Coladangelo, who are both married with three children, kissing. The newspaper said they had been taken inside the Department of Health on 6 May.
Mr Hancock has ended his 15-year marriage to his wife, Martha, and the relationship with Ms Coladangelo is understood to be a serious one.
Fellow Tory MPs, as well as Labour and the Covid-19 Bereaved Families for Justice group, had called for the health secretary to be sacked and a senior Tory figure told the BBC that many MPs had told their whips on Saturday that he ought to resign.
BBC political editor Laura Kuenssberg said No10 had stressed that it had been Mr Hancock’s decision to go and that he had not been pushed out by the prime minister.
She said Ms Coladangelo was also leaving her role as a non-executive director of the Department of Health.
In a video posted on Twitter, Mr Hancock said: “I have been to see the prime minister to resign as secretary of state for health and social care.
In his resignation letter, Mr Hancock, who served as health secretary for three years, reiterated his apology for “breaking the guidance” and he apologised to his family and loved ones for “putting them through this”.
In response, the prime minister said Mr Hancock “should leave office very proud of what you have achieved – not just in tackling the pandemic, but even before Covid-19 struck us”.
He added: “I am grateful for your support and believe that your contribution to public service is far from over.”
Mr Javid, who has held several key roles in government, said he was “honoured” to be appointed as health secretary “at this critical time”.
Honoured to have been asked to serve as Secretary of State for Health and Social Care at this critical time.
I look forward to contributing to our fight against the pandemic, and serving my country from the Cabinet once again.
— Sajid Javid (@sajidjavid) June 26, 2021
His return to cabinet comes 16 months after he resigned as chancellor when he rejected the prime minister’s order to fire his team of aides.
Before that Mr Javid was home secretary. He has also led the housing, communities, business and culture departments.
One of his first jobs as health secretary will be to examine the data ahead of England’s proposed end to Covid restrictions on 19 July.
Former health secretary Jeremy Hunt described Mr Javid’s appointment to the role as an “excellent choice”, saying it was the best possible news for social care because his time at the Department for Communities and Local Government meant he “gets it”.
However, Labour leader Sir Keir Starmer said Mr Johnson should have sacked Mr Hancock rather than wait for him to resign.
The SNP’s Westminster leader Ian Blackford tweeted: “Massive failure of leadership by Boris Johnson, Hancock should have been sacked.”
Liberal Democrats leader Sir Ed Davey tweeted that Mr Hancock’s legacy was one of “failure” and he said the fact that Mr Johnson “could just carry on regardless brings the prime minister’s judgement into question once again”.
One out and one in. The prime minister had backed Matt Hancock to hang on.
The now former health secretary had tried to cling on. But even on Friday senior Tories were directly warning both of them that his position was just not tenable.
Not because of his personal exploits with a taxpayer-supported colleague, but because he broke the rules that he helped to set.
One senior Tory told me it “beggared belief” that the man who had essentially banned casual relationships for a year was caught out having disobeyed the guidance himself, but still tried to maintain his position. Another insider said “everyone hates hypocrisy”.
For every moment that he tried to stay both his and Boris Johnson’s judgement remained in doubt.
Tory MP Andrew Bridgen told BBC News it had become clear that a “sizeable minority or even a majority of the public no longer had confidence in Matt Hancock”.
Mr Bridgen added it “was not the affair but the hypocrisy of being someone who makes the rules and then broke the rules”.
Rivka Gottlieb, from the Covid-19 Bereaved Families for Justice group, told BBC News it was “absolutely right” that Mr Hancock resigned but said she thought he should have been sacked months ago over his “appalling record”.
Concerns had also been raised about the process which saw Ms Coladangelo, a friend of Mr Hancock’s from their days at Oxford University, appointed to the role – last September.
A No 10 spokesman has insisted the “correct procedure” had been followed but refused to go into detail.