Sunak faced down the rebellion by right-wingers in his Conservative Party on Wednesday by offering token compromises to those who demanded he toughen a new bill to tackle illegal immigration in moves centrists feared could breach human rights protections.
In the end only 11 of Tuesday's almost 60 rebels decided to vote against the legislation in a vote in the House of Commons (the lower house), known as a third reading. Some worried that if they did not back it, they could inadvertently collapse the government.
With the Conservatives trailing the opposition Labour Party in opinion polls before this year's election, some MPs were concerned about rejecting a plan voters might feel could reduce illegal immigration - a crucial issue for some Britons.
"The passing of the bill tonight marks a major step in our plan to stop the boats," a spokesperson for Sunak's office said.
"We have a plan, we have made progress and this landmark legislation will ensure we get flights off to Rwanda, deter people from making perilous journeys across the Channel and stop the boats."
But rebels are angry over what they see as Sunak's disregard for their concerns, something that could come back to haunt him as he tries to unite his party before the election later this year.
Earlier, votes on proposed changes to the draft legislation showed almost a fifth of Conservative lawmakers wanted their leader to toughen the plan, an argument that deepened divisions in his party between its right-wing and more numerous centrists.
While ultimately most backed Sunak's plan, they warned him they would continue to inflict pressure on him to reduce immigration.
Some Conservatives blame Sunak for failing to reinvigorate the party's fortunes after replacing his short-lived predecessor Liz Truss in 2022. But faced with the possibility of triggering an early election, they decided voting against him was a step too far.
'LAST CHANCE'
Sunak has made stopping arrivals of asylum seekers crossing over from France in small boats a central aim of his government and says the Rwanda plan would create a deterrent.
Under the plan, migrants who arrive in Britain illegally face being sent to Rwanda some 6400km away to have their asylum claims processed.
While most migrants say they are fleeing wars in the Middle East, Africa and South Asia, the British government describes many of them as economic migrants rather than genuine refugees.
During the earlier debate in parliament, Suella Braverman, who was sacked as interior minister by Sunak last year and is a vocal supporter of a toughened Rwanda plan, said strengthening the law was "our last chance to get it right".
Ultimately, Sunak sided with his more centrist lawmakers, who said that strengthening the plan could result in Britain breaking international law - something Rwanda warned the government could force it to leave the deal.
The government says it has paid £240 million ($NZ497 million) to Rwanda so far, and no asylum seekers have been sent there.
Labour leader Sir Keir Starmer said only Sunak's government could spend "hundreds of millions of pounds on a removals policy that doesn't remove anyone".
Yolande Makolo, Rwanda's government spokesperson, said Rwanda had "no obligation" to return the funds but would consider a request for a return of a portion of the money if no migrants arrived in Rwanda.
Defeating the rebellion may offer Sunak some breathing space to focus on tackling Britain's flagging economy and offer voters tax cuts in a budget on March 6.
But immigration is not likely to go away, as the Rwanda legislation will next head to parliament's upper house, the House of Lords, where it could face stumbling blocks.
"It is not the case that tonight's vote is the end of matters," said a source at a meeting of some rebels before the vote. "The Prime Minister is by no means out of the woods."