Narrated Jabir:
"The Messenger of Allah (ﷺ) prohibited that a man sleep on a terrace without something to obstruct him (so that he will not roll off and fall)."
English reference: Vol. 5, Book 41, Hadith 2854
Arabic reference: Book 43, Hadith 3091
Read hadith from the major collections in the app, with prayer times and a Qibla compass. Free.