So it looks like we're heading for a Brexit. So what happens next?
No one knows. However, it is likely that David Cameron, the Prime Minister, will want to make a statement as soon as the result is known, probably on the steps of Number 10, as he did moments after the result was declared in the Scottish independence referendum.
A statement is likely if only to calm the London Stock Market, which opens for trading at 8am.
But one thing is for sure: one of the biggest political decisions made by British voters is going to have a massive impact on many aspects of not only politics, but daily life and even the very fabric of the United Kingdom.
Here The Telegraph's team of journalists and commentators chart some of the key issues that Britain will face after a vote to Leave.
Our trading relationship will change
New trade deals will need to be struck with the European Union, but how easy that will be is open to much interpretation.
Simon Hix, a professor of Political Science at the London School of Economics and Political Science, writes:
"If the UK withdraws, the liberal democratic project for Europe will become marginalised, as the EU will become dominated by the corporatist and bureaucratic instincts of some of the French and German elites and the politics of the growing populist Right movements.
This would have a huge impact on the UK, as the EU's single market would continue to be our dominant trading partner and we would inevitably have to apply EU single market rules to be able to sell our goods and services to the continent.
Put simply, whether we are inside or outside the EU we will continue to trade more with Germany than the US, more with Italy than India, more with Belgium than Australia, more with the Netherlands than New Zealand, more with Sweden than Canada, and so on, because geographic closeness is by far the biggest predictor of trade patterns."
Talks with EU leaders will begin
Angela Merkel, the German Chancellor, has warned that Britain would be treated as a "third party" and have no access to the Single Market.
"If Britain votes to leave the EU, it will no longer be able to benefit from the advantages of the European common market. And any negotiation will involve the 27 remaining EU members with someone who would then be a third party," Mrs Merkel said.
"I can't imagine that (its status after leaving) would be any kind of advantage, but the decision is ultimately up to the Britons," she added.
Jean-Claude Juncker, a veteran European federalist, said the "crisis" of a Brexit would precipate closer integration.
He admitted the EU had made "major mistakes" by meddling in national life for decades.
"I don't think the EU will be in danger of death if Britain leaves. We will continue the process of closer cooperation in Europe, if not of deepening the EU, and mainly the economic and monetary union."
Michel Sapin, the French finance minister, said Brexit will be a "difficulty for Europe, for ourselves but first and foremost a tragedy for Britain."
Donald Tusk said he is not "optimistic" about Britain staying in the EU in light of recent polls, as European leaders admitted for the first time that detailed plans are being prepared for an exit.
After months of insisting that there is no 'Plan B', it was confirmed that "precise" arrangements are being laid for the days after an exit vote, and the groundwork is being laid for a radical centralisation of powers to prevent the bloc from disintegrating.
"I know it is very difficult for us to be optimistic today, we know the latest polls," said Mr Tusk, the president of the European Commission. "But it's still 50-50, everything is possible."
Mr Tusk went on: "Because we are still in consultation process, we have to be discrete.
"But I can assure you we will be ready and also very precise during our European Council meeting when it comes to Brexit, the political and formal legal results of potential Brexit."
Mr Cameron is scheduled to see his 27 counterparts at a summit on June 28, five days after the referendum.
In an emotional address, Mr Tusk, a Pole, said the costs of leaving will be "really high" for economies across the continent, and weaken it in the face of Russian challenges.
Mr Tusk said: "History taught us we were always defeated when divided, and we always won when stood united."
"The UK has achieved the position of a key state within the EU, whose voice is respected - today more than ever before.
"Many of the British ideas about the EU are gaining support all over Europe. There are so many things we can do together. Leaving now doesn't make any sense."
Scotland could call for a second independence referendum
Nicola Sturgeon has ordered officials to draw up contingency plans for a second independence referendum if the UK leaves the EU against the will of a majority of Scots, it emerged yesterday.
The First Minister told MSPs "all options to protect our relationship with Europe and the European Union will require to be considered" if Scotland faced the prospect of leaving the EU against the wishes of most voters.
Her official spokesman later confirmed she was referring to plans for a second referendum rather than any potential legal or parliamentary mechanisms to block or delay Brexit.
Ms Sturgeon's intervention was a marked change in tone from her rhetoric during the past few weeks when she has gone quiet about Brexit triggering another independence referendum.
Opinion polls have suggested the nationalists would lose again, following warnings that an independent Scotland in the EU could not be expected to adopt sterling, which would become the currency of a non-EU nation.
However, David Cameron and Sir John Major both warned last week that Brexit could spell the end of the Union. Speaking at yesterday's First Minister's Questions, Ms Sturgeon said plans were being made to counter the "economic shock" of leaving the EU.
She told MSPs: "Let me be very clear. As First Minister, my duty is to seek to protect Scotland's interests in all circumstances and, therefore, I am ensuring that appropriate planning for all eventualities is being undertaken by the Scottish Government.
"Let me also say-I have said this many times before-that, if Scotland faces the prospect of being taken out of the European Union against our democratically expressed will, all options to protect our relationship with Europe and the European Union will require to be considered."
Asked later about the options available to the Scottish Government, Ms Sturgeon's official spokesman played down the use of such legal or parliamentary mechanisms.
He said contingency plans were "more in the political than the legal sphere" and referred to the SNP manifesto, which argued that the UK leaving the EU against Scotland's will could trigger a second referendum.
He said: "It is a very, very specific reference to exactly this scenario which was spelled out in a black and white. That proviso is in the manifesto. That would influence thinking."
Family travel will become more expensive
The cost of a family summer holiday to the Mediterranean and other popular EU destinations could rise by £230 if Britain votes for Brexit, David Cameron warned last month. The exact figures will always be open to debate, but here are five areas where leaving the EU could make life more expensive, more difficult and generally less pleasant for travellers and holidaymakers.
• Higher air fares. The huge success of the no-frills airlines and the impact they have made on reducing fares and opening up new routes would not have happened in the way it has if the EU had not been at the forefront of removing the old restrictions on air service agreements and introduced more open competition on routes between Union countries.
• Less safe holidays. Another leading travel industry figure, Peter Long, the former joint chief executive of the tour operator TUI, also warned that the EU's ability to ensure that European countries worked together in crises such as last year's terror attacks in Tunisia, was of vital help in ensuring the best possible security for holidaymakers.
• A weaker pound? Economists disagree, as Brexit might weaken the euro as much as it undermines the value of the pound - but there is a significant risk that the pound may drop, and we could see an end to the relatively good value we have been enjoying in European destinations for the last year or so.
• Fewer reciprocal health benefits? The European Health Insurance Card (EHIC) entitles UK citizens to free or reduced-cost treatment in other EU countries. It doesn't have the same benefits as travel insurance, but if you have one, many travel insurance policies will waive the excess payment on a claim. In the event of a Brexit, such agreements would have to be renegotiated and there is no guarantee of the same result.
• Higher mobile phone roaming tariffs? Pressure from the EU has meant that the costs of using your phone in Europe have plunged in recent years, and roaming charges will be abolished entirely in June 2017. Given how hard it has been to force some of the biggest operators to reduce their rates in the first place, if we are no longer in the EU, it looks a certainty that prices will rise again.
Here are five more areas in which travellers could be affected by a vote to Leave.
Expats will be worried about their status
British expatriates may have to stop living abroad in European countries like France and Spain if Britain leaves the European Union, the Government has suggested.
Europe Minister David Lidington warned that a British exit would see "everything we take for granted about access to the single market" in question, including "the right of British citizens to go and live in Spain or France".
Pro-EU advocates suggest that British expatriates reside in other European countries thanks to the European Union's right of free movement, which means EU members cannot bar or expel citizens of other EU states. On that basis, a former attorney general, Dominic Grieve QC, has argued that a withdrawal would see British citizens living in EU countries "becoming illegal immigrants overnight" if Britain didn't maintain some form of free movement after leaving the EU.
There are some fears that member states, angered by Britain exiting, could try to put pressure on British expats in revenge. As an example, Spain could ask British retirees to pay for their own healthcare - according to the Centre for European Reform's John Springford - or move to curb access to healthcare services outright.
In a paper outlining the risks of Brexit, the Government said: "Many UK citizens would want any negotiations to secure their continued right to work, reside and own property in other EU states, and to access public services such as medical treatment in those states. UK citizens resident abroad, among them those who have retired to Spain, would not be able to assume that these rights will be guaranteed."
Could expats really be barred from EU healthcare and benefits?
It's possible, but unlikely - not least given that it would open the door to retaliatory measures from the UK which hosts its own share of expats from European nations: there are as many as 3 million EU nationals living in Britain.
Could Brexit see expats deported by EU members?
Almost certainly not. First, there are numerous political reasons for EU states not to do such a thing, including the treatment of their own, numerous, nationals living in the UK. Mass expulsions of citizens from another developed economy would also startle foreign investors and potentially cause economic turmoil in the expelling country.
Expats would also enjoy significant legal protections that would apply after Brexit. Many lawyers argue that British expats living elsewhere in the EU at the time of Brexit would have individual "acquired rights" under international law.
This is based on the Vienna Convention of 1969, which says that the termination of a treaty "does not affect any right, obligation or legal situation of the parties created through the execution of the treaty prior to its termination." The House of Commons Library says that "withdrawing from a treaty releases the parties from any future obligations to each other, but does not affect any rights or obligations acquired under it before withdrawal."
In other words, Brits who have already exercised their right to live in EU states can expect to keep that right after Brexit.
One important point though: this only applies to people who have started expat life in the EU before Brexit.
After Britain had left, Brits' ability to live and work in EU nations would depend on new agreements the UK negotiated with those nations.