Imam al-Safārini [d. 1188 AH] – “If he doesn’t sleep and remains awake doing no good, rather it may be [he remains awake] engaging the heedless, chatting with them [late into the night], not even committing major sins and crimes, sleep would be better for him. Perhaps it might be obligatory on such a person if there was no way for him to cease [this imprudent habit] except through sleep.
For sleep is silence and peace [from committing mistakes], as one of the salaf said: there will come a time upon the people where their silence and sleep are from their best deeds”
–––– Ghadhā al-Albāb – Pg. 2/282 [Dar al-Kutub al-‘Ilmiyyah]