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.
The bill, put forward by Labour’s Yvette Cooper, was passed by the Commons in just one day.
However, it will need to be approved by the Lords before it becomes law. It would also still be for the EU to decide whether to grant any extension.
The vote comes after Theresa May met Jeremy Corbyn for talks on Brexit.
The discussions between the leaders, who are trying to find agreement on a way forward, were described as “constructive”, but Mr Corbyn added that they were “inconclusive”.
Teams from both parties were meeting on Wednesday evening ahead of a full day of talks on Thursday to see if they can agree a Brexit plan to put to a vote in the House ahead of an emergency EU summit on 10 April.
If they cannot, the prime minister has pledged to put a number of options to the vote - including the deal she has negotiated with the EU, which has already been rejected by MPs three times.
Ms Cooper’s attempts to prevent a no-deal departure from the EU faced opposition from Tory Brexiteers.
They expressed frustration at the highly unusual process of a bill - the first stage of enacting a law - clearing all stages in the Commons in a matter of hours, rather than months.
One, Peter Bone, urged Speaker John Bercow to “make this farce stop” and prevent further votes.
However, the bill could undergo further scrutiny in the Lords as early as Thursday.