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 will need Lords approval to become law, while it is the EU who decides whether to grant an extension.
It comes as talks between Prime Minister Theresa May and Labour leader 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".
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 - the first stage of enacting a law - 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."
The government's attempt to limit the bill's powers resulted in a 180-vote defeat - the second biggest defeat for a government in modern times.
Responding to the Commons vote, the government said the bill would place a "severe constraint" on its ability to negotiate an extension to the Brexit deadline before 12 April, the date the UK is due to exit.
The draft legislation will next be considered in the Lords as early as Thursday.
'Useful but inconclusive'
It comes as talks between government negotiators and Labour are set to continue throughout Thursday after Mrs May and Mr Corbyn agreed a "programme of work".
A No 10 spokesman said on Wednesday that both parties showed "flexibility" and "a commitment to bring the... uncertainty to a close".
Mr Corbyn said the meeting was "useful, but inconclusive", adding there had not been "as much change as [he] had expected" in the PM's position.
The prime minister wants to agree a policy with the Labour leader for MPs to vote on before 10 April - when the EU will hold an emergency summit on Brexit.
But if they cannot reach a consensus, she has pledged to allow MPs to vote on a number of options, including the deal she has negotiated with the EU, which has already been rejected twice by MPs.
In either event, Mrs May said she would ask the EU for a further short extension to Brexit in the hopes of getting an agreement passed by Parliament before 22 May, so that the UK does not have to take part in European elections.
The cross-party talks have provoked strong criticism from MPs in both parties, with two ministers resigning on Wednesday.
Chris Heaton-Harris quit on Wednesday afternoon, claiming his job at the Department for Exiting the European Union had become "irrelevant" if the government is not prepared to leave without a deal.
Wales Minister Nigel Adams also resigned, saying the government was at risk of failing to deliver "the Brexit people voted for".
Reports in papers including the Sun suggest as many as 15 more - including several cabinet ministers - could follow if Mrs May strayed too far from previous commitments.
Among her "red lines" was leaving the EU's customs union, which allows goods to move between member states without undergoing checks or being subject to tariff payments.
Labour wants a new permanent customs union with the EU, while Northern Ireland's Democratic Unionist Party - which has propped up Mrs May's government - indicated on Wednesday that it could support the idea.
In an interview on ITV's Peston programme, Mr Hammond said that - while the Conservative manifesto had pledged to leave the EU customs union - "some kind of customs arrangement" was always going to be part of the future structure.
Asked about a public vote to confirm approval of the final Brexit deal, Mr Hammond said: "Many people will disagree with it. I'm not sure there's a majority in Parliament for it, but it's a perfectly credible proposition and it deserves to be tested in Parliament."
Mr Corbyn is coming under pressure from senior colleagues in his party to make a further referendum a condition of signing up to any agreement.
Demanding the shadow cabinet hold a vote on the issue, shadow foreign secretary Emily Thornberry said not backing a confirmatory vote would be a "breach" of the policy agreed by party members at its last conference, BBC reports.
The party's deputy leader, Tom Watson, told Peston that Labour members would "find it unforgiveable" for "us to sign off on Theresa May's deal without a concession that involves the people".
However, party chairman Ian Lavery is reported to have warned against the idea, arguing that it could split the party.
European leaders will continue deciding how to respond to Brexit, with Ireland's prime minister, Leo Varadkar, hosting German Chancellor Angela Merkel in Dublin later.
The UK has until 12 April to propose a plan to the EU - which must be accepted by the bloc - or it will leave without a deal on that date.
© 2017 - All Rights with The Financial Express