Labour MP Hilary Benn's amendment was approved by 315 votes to 274 - and led to the resignation of Digital minister Margot James, who voted against the Government.
Former Tory MP Nick Boles said he was "proud" to accompany the minister and Conservative MPs Steve Brine, Richard Harrington and Alistair Burt "through the Aye lobby".
"Heroes all of them," he said.
For Boris Johnson to try to shut down Parliament to force through a destructive 'no deal' Brexit would be a constitutional outrage. Now it would also be unlawful. A huge victory. https://t.co/f6lmYaI6db- Keir Starmer (@Keir_Starmer) July 18, 2019
Crucial victory to prevent Boris shutting the doors of Parliament to get his way in October. He refused to rule out 'proroguing' Parliament in order to Brexit with no-deal...so backbench MPs worked across the parties to rule it out for him. ✅- Chris Leslie (@ChrisLeslieMP) July 18, 2019
Chancellor Philip Hammond, Justice Secretary David Gauke, International Development Secretary Rory Stewart, Secretary of State for Northern Ireland Karen Bradley, Business Secretary Greg Clark and Immigration minister Caroline Nokes are all believed to have abstained from the vote.
Remain MPs were jubilant at the "huge victory".
Shadow Brexit Secretary Keir Starmer tweeted: "For Boris Johnson to try to shut down Parliament to force through a destructive 'no deal' Brexit would be a constitutional outrage. Now it would also be unlawful. A huge victory."
Independent Group for Change MP Chris Leslie tweeted: "Crucial victory to prevent Boris shutting the doors of Parliament to get his way in October. He refused to rule out 'proroguing' Parliament in order to Brexit with no-deal... so backbench MPs worked across the parties to rule it out for him."
Anti-no deal rebels reckon 2 Cabinet ministers are ready to abstain on their amendment at lunchtime... let's see. Whispers too about poss resignations - at least one has already planned to announce they are off next Tues rather than wait to be sacked, not sure they'll jump today- Laura Kuenssberg (@bbclaurak) July 18, 2019
MPs voted on legislation that could potentially thwart efforts by the next Prime Minister to try to suspend Parliament to force through EU withdrawal without an agreement on October 31.
Laura Kuenssberg, the BBC's political editor, suggested at least one minister - thought to be Chancellor Philip Hammond - will also resign next week before they are sacked.
Justice Secretary David Gauke was rumoured to be considering resigning after he said proroguing Parliament would be "outrageous" - but he did not confirm whether he would back the measures to block it.
He told BBC Radio 4's Today programme: "I will have to see what the precise amendments are and we're hearing what the whipping will be and the arguments for that so I'm not in a position to necessarily say.
"But what I would say is the idea that Parliament should be suspended in October - a period where it always sits, Parliament has always in recent years sat at that time of year.
"And at a crucial point in this country's history, if you like - that Parliament should not be able to sit, should not be able to express its opinion and its will, I think would be outrageous.
"I very much doubt that any Prime Minister would in fact suspend Parliament in these circumstances, but I can understand the concerns that a lot of my colleagues have."
Front runner for the Tory leadership Mr Johnson again refused at the final campaign hustings on Wednesday to rule out proroguing - suspending - Parliament in order to meet his red line of getting the UK out of the EU by October 31.
Mr Johnson's team are rumoured to have devised a plan to hold the Queen's Speech, in which the PM lays out his policy programme, in November.
Such a move would mean MPs would be sent home two weeks before it - effectively suspending Parliament and allowing a no-deal Brexit to happen without any interference.
Rival for Number 10 Jeremy Hunt has insisted he would not use such a constitutional manoeuvre to force EU withdrawal.
- This article first appeared on Yahoo
Read more from Yahoo News UK: