All trace of Gollum is lost.
It is thought that at about this time, being hunted both by the Elves and Sauron’s servants, he took refuge in Moria; but when he had at last discovered the way to the West-gate he could not get out.
Months prior, Gollum had been released from Mordor and taken by Aragorn in the marshes. Aragorn then took Gollum to Thranduil in Mirkwood where he remained a prisoner. The Elves were far kinder than the Orcs but it was still an unpleasant place for Gollum to reside.
Once Sauron had discovered that the Elves had this creature he sent his forces to attack Mirkwood. It’s unknown whether or not this attack was to kill Gollum or allow him the means to escape. We do know that Sauron certainly didn’t want Gollum telling the Elves any of his plans. So there Gollum is left, throughly beaten, wandering Middle-earth alone without the Ring.
Thank you for your time, and remember, not all those who wander are lost.
– The Wandering One