Christian Calderwood was forced to stop by other drivers who surrounded him with their vehicles and took his keys.
Stirling Sheriff Court was told that Calderwood, 42, was barely able to stand by the time police arrived.
Calderwood, of Kirkintilloch, East Dunbartonshire, will be sentenced in April.
The court heard that Calderwood was spotted driving erratically on the M80, west of Stirling, at about 17:00 on 23 May last year.
Motorists saw him speeding up and slowing down, and veering from lane to lane.
Lindsey Brooks, prosecuting, said that other motorists were so concerned about the way he was driving that they began to follow him, and saw that he then joined the M9.
A truck driver saw Calderwood's car come up behind him, almost hit him, then overtake and just miss the rear of the lorry before drifting onto the hard shoulder and back again onto the motorway.
After seeing further erratic driving, the truck driver slowed to a halt near the Park of Keir roundabout forcing Calderwood to stop behind him.
Mrs Brooks said other motorists stopped alongside Calderwood, "effectively blocking him in".
One witness took the keys out of his car's ignition.
Mrs Brooks said: "The witnesses spoke to the accused, who seemed to be confused and foaming from the mouth.
"The police noted he was unsteady on his feet, unaware of his surroundings, where he was, or what he was doing.
"There appeared to be white powder round his mouth and the officers said they were having difficulty keeping him awake."
He was told to take a roadside breath test, but did not appear to understand what he was being asked to do.
A blood test later showed high levels of Etizolam, a benzodiazepine which is prescribed for anxiety and insomnia in India and Japan.
Calderwood admitted driving while unfit through drugs.
Sheriff Richard McFarlane deferred sentence for four weeks for reports and disqualified Calderwood from driving in the interim.
He said: "From the description I have, you were hardly fit to stand, let alone drive a vehicle."
A man who drove for 20 miles on a motorway after taking drugs was "foaming from the mouth" when he was stopped by police, a court has heard.