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 a 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 Conservative and Labour teams to end the Brexit deadlock continue.
Discussions between Prime Minister Theresa May and Labour leader Jeremy Corbyn on Wednesday were described as “constructive”, but were criticised by MPs in both parties.
Brexit Secretary Stephen Barclay told MPs he would hope the Lords would “scrutinise this bill passed in haste with its constitutional flaws”.
He added that there was “no guarantee” that the UK will not take part in the European elections in May and to participate would be a “betrayal” and “inflict untold damage”.