MPs have backed a bill aimed at blocking a no-deal Brexit on 31 October.
Opposition MPs and Tory rebels ensured the bill passed by 327 votes to 299.
The bill forces the PM to ask for an extension beyond the 31 October Brexit deadline if a deal has not been agreed with the EU.
Boris Johnson said MPs had "scuppered" the Brexit talks, but Labour's Sir Keir Starmer said there had not been any progress in the negotiations.
MPs also voted on amendments to the bill - put forward by MPs, but chosen by the Deputy Speaker.
One amendment appeared to pass without a vote as no tellers were available to count the votes against it, said BBC Parliamentary correspondent Mark D'Arcy.
It was put forward by Labour's Stephen Kinnock to force an extension to the Brexit deadline to allow MPs to vote on Labour's proposed changes to former Prime Minister Theresa May's withdrawal agreement back in May.
During his first Prime Minister's Questions, Mr Johnson challenged Labour leader Jeremy Corbyn to put his policy of "dither and delay" over EU withdrawal to the British people on 15 October in an election.
But Mr Corbyn said the PM was "running down the clock" on a no-deal Brexit and "hiding the facts" about the likelihood of food and medicine shortages.
Shadow Brexit secretary Sir Keir Starmer has told Labour MPs the leadership would not back an election until a Brexit delay had been agreed with the EU.
The Liberal Democrats have also said they will vote against an early election at this stage.
MPs backing the bill attempted to push it through as quickly as possible so it becomes law before the government suspends Parliament next week.
The bill will then go to the Lords for approval on Thursday - it is unclear what will happen in the Lords, but it could end up being debated through the weekend if opponents manage to filibuster
If the Lords pass any amendments, it will have to return to the Commons for approval.
Once the bill has passed all stages, it will receive Royal Assent from the Queen (making it law).
In the Lords, peers are debating a business motion setting out the rules for how the bill will go forward if it is passed by the Commons.
As it stands, the motion gives a mechanism - known as a "guillotine" - ensuring all stages of the bill are finished in the Lords by 19:00 on Friday.
But pro-Brexit peers have tabled over 100 amendments to try and filibuster the motion and stop the bill going ahead.
Views from the debates
At the start of the debates about the bill, Labour MP and chair of the Brexit Select Committee, Hilary Benn, said: "The bill has wide cross-party support and is backed by members who have very different views on how the matter of Brexit should be concluded.
"What unites us is a conviction that there is no mandate for no deal and the consequences for the economy and the country would be highly damaging."
But Brexit Secretary Steve Barclay said: "The public want a Brexit deal, the business community want certainty [but] this bill will leave our negotiations in purgatory."
Former Tory Chancellor Philip Hammond - who was sacked from his party on Tuesday after voting in favour of the debate - told the Commons: "There is no mandate for a no-deal Brexit and a no-deal Brexit will be a catastrophe for the United Kingdom."
He also "reminded" his former colleagues in government that "many of us now on the backbenches have had the privilege of seeing the detailed analysis from within government about the precise and damaging effects of a no-deal Brexit".
And in her first speech in the Commons, Liberal Democrat Jane Dodds, said: "When it comes to a no-deal Brexit, we need to stop talking in terms of the hypothetical and theoretical, and start talking with candour about real and damaging consequences it would bring. It would be catastrophic."
But Tory MP Caroline Johnson said it was a "political bill" that postpones no deal - rather than ruling it out - and made it "virtually impossible" for the prime minister to negotiate with the EU.
What does the no-deal bill say?
The bill says the prime minister will have until 19 October to either pass a deal in Parliament or get MPs to approve a no-deal Brexit.
Once this deadline has passed, he will have to request an extension to the UK's departure date to 31 January 2020 - and, unusually, the bill actually includes the wording of the letter he would have to write.
If the EU responds by proposing a different date, the PM will have two days to accept that proposal. During that time, MPs - not the government - will have the opportunity to reject the EU's date.
The bill also requires ministers to report to the House of Commons over the next few months. potentially providing more opportunities to take control of the timetable.
Be aware though, this could all change over the next few days because MPs and peers have the power to pass amendments to any law.
Mr Johnson had said he would use the Fixed Term Parliaments Act to call for an early general election on 15 October - before the EU summit and the proposed law's imposed deadline - if the bill got through the second vote on Wednesday night.
The prime minister said the MPs' bill would "hand control" of Brexit negotiations to the EU, and he had no choice but to press ahead with efforts to call an October election, adding: "The people of this country will have to choose."
However the prime minister's motion calling for an early election failed to gain enough support from MPs to pass.
Under the Fixed Term Parliaments Act, a prime minister must have the backing of at least two-thirds of the UK's 650 MPs before a poll can be called outside of the fixed five-year terms.
Irish Foreign Minister Simon Coveney said the issue with the negotiations was that Mr Johnson's government had not come forward with any alternatives for the backstop to guarantee an open border.
"This is a problem that's real, that's complex and needs a solution," he said.
The government lost its majority on Tuesday when one of its MPs - Dr Phillip Lee - quit the Conservatives to join the Liberal Democrats.
It dropped further after No 10's decision to remove the party whip from the 21 Tory MPs who voted in favour of taking over Parliament.
One of those booted out of the party, Margot James, has publicly questioned the role played by Dominic Cummings, the PM's senior aide, in the decision.
Raising the issue at PMQs, she urged Mr Johnson to bear in mind his predecessor Margaret Thatcher's famous adage that "advisers advise and ministers decide".