The vote was a culmination of several months of being embroiled in the so-called "Partygate" scandal, with Johnson recently forced to pay a fine for attending a coronavirus lockdown-breaching party in his Downing Street residence. Investigations show that the prime minister also attended several other events that were deemed illegal by police, although he personally was not fined.
Geidt had initially stayed on in his role despite having criticized his boss for not explaining in public how he justified his behavior.
However, he has since endured a difficult time answering questions in front of a committee of MPs.
At the committee hearing, Geidt had said it was "reasonable" to assume that Johnson broke Britain's ministerial code, traditionally a resigning matter, by getting the police fine.
But Johnson has refused to quit, and his office said it was "surprised" at the advisor's decision to step down now.
In his resignation letter, Geidt said he had finally decided to quit his role when he was asked to advise on "a deliberate and purposeful breach of the ministerial code" by the government on an unspecified trade-related issue.
"This request has placed me in an impossible and odious position," he wrote.
"I can have no part in this," added Geidt, a former private secretary to Queen Elizabeth II and personally appointed by Johnson himself.
"There are now no ethics left in this Downing Street regime propped up in office by a Conservative Party mired in sleaze and totally unable to tackle the cost-of-living crisis facing the British people," deputy leader of the opposition Labour party Angela Rayner said.
Conservative MP William Wragg paraphrased the playwright Oscar Wilde, saying: "For the prime minister to lose one adviser on ministers' interests may be regarded as misfortune. To lose two looks like carelessness."
Geidt's predecessor, Alex Allan, quit in November 2020 after Johnson refused to fire his interior minister Priti Patel, who Allan said was guilty of breaching the ministerial code by bullying officials.
The position was empty for five months before Geidt took over.
The prime minister will now review the role, and may leave it unfilled, his spokesman told reporters.
Who is Lord Geidt?
Geidt, born in 1961, is a former army intelligence officer who has worked as a diplomat in Brussels, Geneva and Sarajevo.
In 2002, he began working for the Royal Family going on to become the Queen's private secretary for decade.
Geidt is chairman of King's College London and lives on the Isle of Lewis in the Outer Hebrides, where he grew up and where he now has a sheep farm.