Jami` at-Tirmidhi, Book 43, Hadith 129 (Tirmidhi 2934)

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)."