The Conservatives had comfortably held the leafy, affluent Chesham and Amersham constituency in southern England since its creation in 1974, capturing more than 50% of the vote on every occasion.
The election in the Chesham and Amersham constituency was called after the death in April of Cheryl Gillan, who had represented it for Johnson's Conservatives since 1992. Support for the Conservatives has surged in northern England.
Liberal Democrat leader Ed Davey and new Liberal Democrat MP for Chesham and Amersham, Sarah Green, during a victory rally at Chesham Youth Centre, Chesham, Buckinghamshire, after her by-election victory, June 18, 2021.
Johnson said it was a "disappointing result", suggesting there were "particular circumstances" in the area and "it was a bit bizarre" to suggest his party were on the back foot.
"We would have hoped for a better result", he told Sky News.
"Across the south, the Tory Blue Wall is beginning to crumble", he said in a statement.
Johnson's party in May won a by-election in the traditional Labour-voting Hartlepool, adding another parliamentary seat in northeast England to those they secured in the last general election in December 2019, when Brexit was the main issue.
The Conservatives have made big inroads into Labour's "Red Wall" in recent years, winning a swathe of seats on a combination of factors, notably Johnson´s insistence that he would ensure that Britain leaves the European Union after years of parliamentary haggling.
But some have said the approach that is attracting traditional Labour voters in northern England has also alienated some of Johnson's base in the Conservatives' own strongholds.
In a tweet Ms Green seemed to suggest Conservative voters in the Chesham and Amersham constituency had felt taken for granted by the party headquarters in the same way as Labour voters had in Hartlepool.
"What we want is sensible plans to allow development on brownfield sites. but I do think young people growing up in this country should have the chance of home ownership".