Srimad-Bhagavatam: Canto 3 - Chapter 1 - Verse 41


जगृहुस्तद्विसृष्टां तां जृम्भणाख्यां तनुं प्रभो: ।निद्रामिन्द्रियविक्लेदो यया भूतेषु द‍ृश्यते ।येनोच्छिष्टान्धर्षयन्ति तमुन्मादं प्रचक्षते ॥ ४१ ॥


jagṛhus tad-visṛṣṭāṁ tāṁjṛmbhaṇākhyāṁ tanuṁ prabhoḥnidrām indriya-vikledoyayā bhūteṣu dṛśyateyenocchiṣṭān dharṣayantitam unmādaṁ pracakṣate


The ghosts and hobgoblins took possession of the body thrown off in the form of yawning by Brahmā, the creator of the living entities. This is also known as the sleep which causes drooling. The hobgoblins and ghosts attack men who are impure, and their attack is spoken of as insanity.


The disease of insanity or being haunted by ghosts takes place in an unclean state of existence. Here it is clearly stated that when a man is fast asleep and saliva flows from his mouth and he remains unclean, ghosts then take advantage of his unclean state and haunt his body. In other words, those who drool while sleeping are considered unclean and are subject to be haunted by ghosts or to go insane.