Katha Upanishad Verse 2.1.4
This verse identifies the Atman as the singular witness of all states of consciousness. Whether in the waking state or the dream state, it is the same all-pervading Self that perceives. Realizing this great, eternal presence frees the individual from all sorrow.
Sanskrit Verse
स्वप्नान्तं जागरितान्तं चोभौ येनानुपश्यति । महान्तं विभुमात्मानं मत्वा धीरो न शोचति ॥ ४ ॥
Transliteration
svapnāntaṃ jāgaritāntaṃ cobhau yenānupaśyati । mahāntaṃ vibhumātmānaṃ matvā dhīro na śocati ॥ ४ ॥
Translation
That by which a mortal perceives, both in dream and in waking, by knowing that great all-pervading Ātman the wise man grieves no more.

Muni's Play