It is mentioned in hadith that mosques are built to offer five times fardh salah and for the remembrance of Allah. It is mentioned in another hadith that only motakif, traveller or a person who stays there for religious purpose are allowed to eat and sleep in mosque provided they maintain the etiquettes of the mosque and no one else is allowed to sleep or eat there. Hence common Muslims are not allowed to sleep in the mosque. It is the sacrilege and desecration of the mosque.
Allah (Subhana Wa Ta’ala) knows Best
Darul Uloom Deoband