Christopher Geidt did not give a reason for his resignation but had previously called on the prime minister to explain his conduct in the "partygate" affair.
British Prime Minister Boris Johnson suffered a further blow to his authority on Wednesday when his second ethics adviser in less than two years quit his post.
Johnson last week survived a confidence vote that saw 41% of his lawmakers casting ballots against his leadership after months of scandals and gaffes that have raised questions over his authority to govern and knocked his standing with the public.
Last month Christopher Geidt, the independent adviser on ministers' interests, said Johnson must explain why he thought he had not broken the ministerial code after being fined over attending a party during the COVID-19 national lockdown.
"With regret, I feel that it is right that I am resigning from my post as Independent Adviser on Ministers’ Interests," Geidt said in a statement posted on the government's website.
Geidt, whose role was to advise Johnson on matters relating to the ministerial code of conduct, did not give a reason for his resignation.
Geidt, the Queen's Private Secretary for 10 years until 2017, was appointed by Johnson in April 2021. The previous holder of the role resigned in 2020 in protest at Johnson's support for a minister who was found to have broken the code.
"The Prime Minister has now driven both of his own hand-picked ethics advisers to resign in despair. If even they can't defend his conduct in office, how can anyone believe he is fit to govern?" opposition Labour Party Deputy Leader Angela Rayner said.
Geidt last year called for his role to have "considerably greater authority, independence and effect", but when the government updated the ministerial code last month it said that, while he could now initiate an investigation, he was still required to consult the prime minister.
He had also previously criticised the fact that an exchange of messages had not been disclosed to him when investigating who funded a costly refurbishment of Johnson's Downing Street flat.