But if MPs do not back the withdrawal agreement then the EU will agree to a shorter delay until April 12.
As leaders convened for day two of the EU summit in Brussels, Brexit was still firmly on the agenda.
British Prime Minister Theresa May skipped the second day and headed back to London after the EU agreed on a plan to delay Brexit until May 22, 2019, if MPs approve the withdrawal agreement next week.
If ministers do not back the deal then the EU will agree to a shorter delay until April 12.
But in a letter to MPs on Friday, the British prime minister hinted she may not bring her Brexit deal back to the House of Commons for a third time next week if there was not enough support for it to be passed.
“If it appears there is not sufficient support to bring the deal back next week, or the House rejects it again, we can ask for another extension before April 12 - but that will involve holding European Parliament elections,” she wrote in a letter published on Twitter by the BBC's Laura Kuenssberg.
European Council President Donald Tusk and European Commission President Jean-Claude Juncker held a joint press conference on Friday afternoon in which they said leaders had "formalised last night’s decision by the EU27 and the UK to delay the cliff edge".
"I am really happy about this development," said Tusk. "It means that until April 12 anything is possible — a deal, a long extension if the UK decided to rethink its strategy of revoking Article 50.
"The fate of Brexit is in the hands of our British friends."
EU leaders made their stances clear on Brexit.
German Chancellor Angela Merkel said the EU27 would convene before April 12, in the presence of May, but took a hard line on the subject of negotiations.
"We will not reopen negotiations on the withdrawal agreement," she said.
Irish PM Varadkar has similar views concerning further Article 50 extensions for the UK, saying there categorically would not be any.
Macron was the last of the leaders to speak, having walked straight past the convened press when he arrived at the summit on Friday morning without stopping for comment.
His message was clear: "Europe must not remain hostage to Brexit."
Our Brussels correspondents brought you minute-by-minute updates from the summit, which you can catch up on here:
EU Council President Donald Tusk wrote in a Tweet the "EU27 responds to UK requests in a positive spirit".
May said late on Thursday “we are now at the moment of decision,” and that she wants to leave with a deal. She said she felt it would be wrong to ask the UK to take part in the EU elections three years after voting to leave.
EU Commission President, Jean-Claude Juncker, told the press conference the atmosphere had been "much better" than he had expected among EU leaders and that he was now "much more realistic".
After twice failing to get parliamentary backing for her EU divorce deal, embattled UK PM May had asked the EU to move the UK's departure date back three months to June 30.