The future of the United Kingdom is hanging in the balance as the SNP's hopes of securing a majority for independence were too close to call.
First Minister Nicola Sturgeon is bidding for an outright majority to boost her claim for another independence referendum.
But she played played down the likelihood of an overall SNP majority at Holyrood earlier in the day, saying it has "always been a very, very long shot".
The final result is expected on Saturday, with the SNP claiming the bulk of the declared seats on Friday night.
Some 65 seats are needed to secure a clear majority.
See the latest results below
By 9pm, the party had won 38 out of 47 declared seats for the 129-seat Scottish Parliament.
The SNP picked up seats in East Lothian and Ayr as well as scooping former Scottish Tory leader Ruth Davidson's Edinburgh Central seat.
But Labour's Jackie Baillie held on to her Dumbarton constituency - the most marginal seat in Scotland - and a top target for the SNP.
Ms Baillie had a majority of just 109 from the 2016 Holyrood election, but she increased that to 1,483 on Friday.
Labour also held Edinburgh Southern, while the Lib Dems retain four seats, including Orkney Islands, Shetland Islands, North East Fife and Edinburgh Western.
The Tories have kept three seats - Eastwood, Dumfriesshire, and Ettrick, Roxburgh and Berwickshire.
Speaking at her count in Glasgow, Ms Sturgeon signalled her plan to press ahead with demanding another independence vote.
She said: “At this stage I am extremely happy that the SNP appears to be on course for a fourth consecutive election victory, and to be on course to have the privilege of forming a government again.
“If that is indeed the outcome of this election, I pledge today to get back to work immediately, to continue to steer this country through the crisis of Covid, to lead this country into recovery from Covid – and then, when the time is right, to offer this country the choice of a better future.”
Some constituencies will be counted on Saturday, when the crucial regional list results will also be declared.
A pro-independence majority, which could include the Greens, would bolster demands for a rerun of the 2014 independence poll.
Scots voted by 55% to 45% nearly seven years ago to remain part of the UK.
Asked if he would go to court to try and stop a second referendum, Boris Johnson said: “Let's see what happens in the course of the next few hours.”
Speaking in Hartlepool, the Prime Minister added: “I think what the people of this country want to see is politicians of all kinds in Scotland, Wales and Northern Ireland, across the whole of the UK, working together to bounce back strongly from the pandemic.
“I don't think people want much more constitutional wrangling right now, that's my strong view.”
He later told the Telegraph: "I think a referendum in the current context is irresponsible and reckless.”
Delivering a victory speech after holding his North East Fife seat, Scottish Liberal Democrats leader Willie Rennie said: "I hope all the candidates in this election hear the message from the voters that now is not the moment for another referendum.
"We need to listen to that."