There will be no "hard border" with Ireland and EU citizens in the UK, and UK citizens in the EU will see their rights protected.

The so-called "divorce bill" will amount to between GBP 35 billion and GBP 40 billion, the BBC understands.

The European Commission president said it was a "breakthrough" and he was confident EU leaders will approve it.

They are due to meet next Thursday for a European Council summit and need to give their backing to the deal if post-Brexit trade talks are to begin.

The UK will then have about a year to hammer out an agreement on future relations, which will have to be ratified by the EU nations and the UK Parliament, before the UK leaves in March 2019.

Northern Ireland's Democratic Unionist Party, whose opposition on Monday led to talks breaking down, said there was still "more work to be done" on the border issue and how it votes on the final deal "will depend on its contents". Mrs. May depends on the party's support to win key votes in Westminster.

The pound was trading at a six-month high against the euro as news broke of the draft agreement.

The joint report agreed by Mrs. May and Mr. Juncker states, that if a trade deal cannot be agreed, the UK will maintain "full alignment" with elements of the EU single market and customs union mentioned in the Good Friday agreement.

Some in the DUP would have liked to remove "full alignment" from the report altogether, but that would not have been acceptable to the Irish government, says the BBC's Chris Morris.

It is a fallback position, he adds, and the detail of how it might be done remains to be negotiated and is likely to be highly controversial.

"But one thing is clear – there is no partial membership of the single market and the customs union on offer. Other EU member states wouldn't accept it", says Chris Morris.

Read alsoTheresa May warns rebels as Brexit talks set to resume – BBCMrs. May said that EU citizens in the UK would have their rights "enshrined in UK law and enforced by British courts".

But the agreement also says the European Court of Justice will continue to have a role in overseeing their rights for eight years after Brexit, a move which may concern some Brexiteers. Guarantees will also apply to UK citizens living in other EU countries.

Theresa May said it would be "fair to the British taxpayer" and would mean the UK in future "will be able to invest more in our priorities at home, such as housing, schools and the NHS".

EU Brexit negotiator Michel Barnier said the EU had agreed to drop the cost of relocating UK-based EU agencies from the final divorce bill.

The UK will remain a "member" of the EU's customs union and single market during any transition period after March 2019, according to a leaked copy of European Council guidelines for the forthcoming trade talks.

The guidelines, which are a separate document to the draft agreement on divorce issues, also suggest the UK will remain under the full jurisdiction of the European Court of Justice during the transition.

Membership of the single market means keeping all of the EU's "four freedoms" - goods, services, capital, and labor – although the UK government says that new long-term arrivals from the EU will have to register during the transition period.

Membership of the customs union restricts the UK's ability to sign new trade deals – but informal negotiations with other countries could still be possible.

Theresa May has asked for a transition period of "around two years" during which the UK will continue to follow the "existing structure of EU rules and regulations".

But she has also told MPs the UK will leave the single market and customs union in March 2019 and freedom of movement "as we know it" will end.