A survey released after polling stations closed said independence could be narrowly rejected, but both "Yes" and "No" campaigners said it was too close to call as counting was underway in Scotland's 32 voting districts.
"So that's that. Polls have closed. What an amazing, emotional, inspirational day of democracy this has been. Now we wait," said Nicola Sturgeon, deputy leader of the Scottish National Party (SNP) that demanded the vote.
"We are going to stay out till the result," said Dylan McDonald, 17, one of Scotland's 16- and 17-year-olds who have been able to vote in the referendum for the first time.
Turnout in many voting districts was touching 90 per cent, meaning turnout could break the previous record set in the general election of 1950.
Also Read
The historic decision gripped many Scots who previously took little interest in politics, igniting passions and raising the prospect of deep changes to the governance of the union no matter the result.
Newspapers of Northern England united to demand the devolution of powers to their regions in a "fair deal after so many promises were made to Scotland during the referendum campaign".
Cameron will speak on the future of the United Kingdom as soon as the referendum outcome is issued, and reports say if independence is rejected he will announce plans to change the division of power in the high-centralised union.
The closure of the airport on the Isle of Lewis due to fog meant ballot boxes would have to travel by slower fishing boat.
At the counting centre in Scotland's oil city Aberdeen, boxes of postal votes were tipped out onto tables at the stroke of 10:00 pm when polls closed, and officials immediately began sorting the ballots.
Election officials in Glasgow said they had contacted police over a handful of allegations that people had turned up to vote only to find their names already crossed off the ballot sheet.
International media descended on the Edinburgh venue where the city's ballots will be totted up to witness a count that could have repercussions from Spain to Canada.