The ego exists within the waking or dream. The ego functions as physical entity, within the waking or dream. The soul is the innermost self. the soul is present in the form of consciousness. Soul or consciousness is the formless substance and witness of the three states.
One should not judge the three states on the standpoint of ego or waking entity, which is limited to waking alone. The witness of the three states is one. But waking entity and dream entity are different. In deep sleep the soul alone prevails and it is aware of the fact that, there is no duality in deep sleep. But due to ignorance it is called deep sleep in waking. The one which is aware of all the three states is formless soul or consciousness is real and eternal.
That which is called deep sleep, where there is no waking or dream experience, because the soul, which is in the form of consciousness has withdrawn itself from waking or dream. This is complete absorption of the consciousness into itself. But this absorption is of an unconscious nature because it is without the wisdom.
The soul, while it appears to be a little conscious in dream, and more conscious in waking, is not conscious at all in deep sleep, is judged on the base of ego or waking entity. The consciousness exists prior to the appearance of the waking [the body, ego and universe], therefore, the consciousness which is the formless knower (witness) and it is apart from the three states.
All sorts of doubts and confusions are based when the judgment is based on the ego as self. Some hold the view that consciousness is possible only when there are objects. Consciousness can exist with or without the object. In waking or dream it is with object. In deep sleep experience it is without the object.
In the waking or dream consciousness is in the form illusion. In deep sleep conciousness is in its formless nondual true nature.