The PM won 59% of the vote, meaning he is now immune from a Conservative leadership challenge for a year.
In all, 211 Tory MPs voted they had confidence in the PM's leadership while 148 voted against him.
Mr Johnson described his confidence vote win as "decisive".
Striking an upbeat tone, he said it was a "very good", "convincing" result and "an opportunity to put behind us all the stuff that the media goes on about".
The result sees the prime minister remain in office, but critics said the scale of the rebellion against him showed his authority had been weakened, with some calling on him to resign.
The vote share in support of Mr Johnson was lower than the 63% received by former Prime Minister Theresa May when she won a party confidence vote in 2018, before resigning six months later over a Brexit deadlock.
Labour leader Sir Keir Starmer said a "divided" Conservative Party was "propping up" Mr Johnson after he survived the confidence vote.
And Liberal Democrat leader Sir Ed Davey said while Mr Johnson had clung on to power, "his reputation is in tatters and his authority is now totally shot".
But Downing Street said the result "renews the PM's mandate" and allows the government to "focus relentlessly on the issues that concern our voters".
Tory MP and Welsh Secretary Simon Hart told the BBC the prime minister "has lots to prove" but insisted the result "was pretty decisive".
Mr Johnson, who became prime minister in 2019, was informed he would face a vote on his leadership on Sunday during the Queen's Platinum Jubilee, after weeks of speculation over his future.
The ballot was triggered by Conservative MPs after at least 15% of them wrote letters of no confidence to Sir Graham Brady, the chairman of the party's backbench 1922 Committee.
Discontent among Tory MPs has grown since a highly critical report into lockdown parties in and near Downing Street during the Covid-19 pandemic was published last month.
The report laid bare the extent of Covid rule-breaking in Number 10, including at a birthday party Mr Johnson was fined by the police for attending in June 2020.
The fine meant Mr Johnson became the UK's first serving prime minister to be sanctioned for breaking the law.
Some Tory MPs have also expressed dissent over tax rises, the government's response to rising living costs and its policy direction.
An arithmetic win for Boris Johnson. But boy, look at those numbers.
The result showed 148 Conservative MPs think the country would be better off shot of him.
That's 148 Conservative MPs, not floating voters.
That is a far higher proportion of his MPs attempting to eject him than wanted rid of Theresa May when she faced a confidence vote. And she was gone within six months.
His supporters say the situation is very different now, but this vote means this issue won't go away. The result is at the upper end of the expectations of the rebels, who never expected to win.
They will see this as losing the battle, but the war to replace him goes on.
The last Conservative prime minister to face a party vote on their leadership was Mrs May, who won the vote but resigned six months later over her approach to Brexit.
Mr Johnson succeeded her in July 2019 and then called a general election in which the Conservatives won their biggest majority since former Prime Minister Margaret Thatcher's 1987 election victory.
The next general election is expected to be held in 2024 but could be earlier if Mr Johnson uses his powers to call one.
The next tests for Mr Johnson are by-elections held in Wakefield and in Tiverton & Honiton on the same day this month following the resignation of two Tory MPs.
The Tory rebels who voted against Mr Johnson were insistent that the result had compromised the prime minister's ability to lead.
One of them, Julian Sturdy, said the result was "clear evidence that he no longer enjoys the full-hearted confidence of the parliamentary party and should consider his position".
Another one, Sir Roger Gale, said the result was very bad he would be surprised if Mr Johnson was still in post by the autumn.
But Mr Johnson's cabinet ministers rallied around him with messages of support.
Health Secretary Sajid Javid said the prime minister had secured "a fresh mandate" from the Conservative Party following his confidence vote win.
Mr Javid tweeted: "Tonight the PM has secured a fresh mandate from the parliamentary party. Now we need to unite and focus on the country's challenges."
Education Secretary Nadhim Zahawi, who said he would back Mr Johnson before the vote, said the PM won "handsomely". "I hope we can draw a line under this issue," he said.
Highlighting Mr Johnson's general election victory in 2019, Culture Secretary Nadine Dorries said it was "time to get back to the job of governing".
The Labour leader said the public were "fed up with a prime minister who promises big but never delivers".
The PM was "utterly unfit for the great office that he holds", Sir Keir said, and Tory MPs have "ignored the British public".
Shadow foreign secretary David Lammy said the result left the prime minister "fatally wounded". "We need someone in office that the British people can trust," he told the BBC. "That's why this vote was so important."
The leader of the Liberal Democrats urged Tory MPs to "do the right thing, resign the whip and sit as an independent. "For the sake of our country, this failing prime minister cannot be propped up any longer," Sir Ed said,
The SNP's Westminster Leader Ian Blackford said he was "stunned" by the result, adding it was a "big thing" for that many Conservatives to vote against their own prime minister.
He said the PM now has the support of less than a third of the House of Commons. "For Boris, this should be over," he said.