Once a humanoid has fully transformed into a mind flayer, the original humanoid is dead and their body is destroyed.
In the AD&D 2e sourcbeook Monstrous Arcana: The Illithiad, p.11, asserts that most normal means are ineffective at restoring their original form:
Ceremorphosis completely replaces the original tissue of the victim with illithid tissue; when the transformation is complete, the original victim is dead. Cure disease, remove curse, raise dead, restoration, resurrection, and / or similar spells cannot reverse this process.
D&D 3e's Lords of Madness, p. 63, states:
Spells such as cure disease and remove curse have no effect; only a heal spell can save a victim undergoing ceremorphosis.
In most cases, the only way to guarantee the tadpole is slain is to crush or incinerate the victim's head. At that point, resurrection, true resurrection, or raise dead come into play.
In other words, while you can stop the transformation before it completes using a heal spell (this also works against other parasitic creatures like the Spawn of Kyuss), once the transformation is completed, the original humanoid is dead and their original body is destroyed; none of the original body remains.
The Illithiad and Lords of Madness don't go into any futher detail, but it stands to reason that anything which can resurrect someone without the original body might work. It's not explicitly stated, but true resurrection or clone may allow this. Wish and miracle can traditionally do just about anything, as can Divine Intervention.
A Ring of Mind Shielding (5e DMG p. 191) absorbs your soul whenever you die while wearing it. Since the process of becoming a mind flayer essentially just kills you and destroys your body, this would let your soul survive within the ring, but restoring your original body would be its own challenge.
A substance known as laethen allows a mind flayer to retain some of their original memories. It's described in Monstrous Arcana: Dawn of the Overmind, p.56. Their body becomes that of a mind flayer, but their original mind is retained. However, they need to take the substance before being transformed, and it only works 40% of the time. You could probably polymorph them back into their original form somehow.
A mind flayer mental illness known as partialism can occur, where part of the original memory is retained, but it's usually only a small amount.