MPs have voted by a majority of one to force the prime minister to ask for an extension to the Brexit process, in a bid to avoid any no-deal scenario.
Labour’s Yvette Cooper led the move, which the Commons passed in one day.
The bill is due to be considered by the Lords later and will need its approval to become law, but it is the EU which decides whether to grant an extension.
It comes as talks between Theresa May and Jeremy Corbyn to end the Brexit deadlock are set to continue.
Discussions between the two leaders on Wednesday were described as “constructive”, but were criticised by MPs in both parties.
Meanwhile, Chancellor Philip Hammond has suggested that he expects Brussels to insist on a lengthy delay to Brexit and described a public vote to approve any final deal as “a perfectly credible proposition”.
But Health Secretary Matt Hancock told BBC Radio 4 Today he was “very strongly against” a public vote and he would not want to see a long extension to the Brexit process.
Ms Cooper’s attempts to prevent a no-deal departure from the EU passed by 313 votes to 312.
The draft legislation by the former Labour minister would force the prime minister to ask the EU for an extension to the Article 50 process beyond 12 April and would give Parliament the power to decide the length of this delay.
Tory Brexiteers expressed frustration at the unusual process of a backbench bill clearing all stages in the Commons in a matter of hours, rather than months.
Mark Francois said: “It’s difficult to argue that you’ve had an extremely considered debate when you’ve rammed the bill through the House of Commons in barely four hours. That is not a considered debate, that is a constitutional outrage.”