How Did Prophet Muhammad Sleep?
Question

I want to know how the Prophet (peace and blessings of Allah be upon him) used to sleep. Did he sleep on a bed or on the floor? Did he used to recite a specific Du`a when he wanted to sleep?
Praise be to Allah.Did the Prophet sleep on the floor?
The Prophet (peace and blessings of Allah be upon him) used to sleep sometimes on a mattress, sometimes on a leather mat, sometimes on a mat made of palm leaves, sometimes on the floor, sometimes on a bed, sometimes on the sand, and sometimes on a black cloak. 
`Abbad ibn Tamim (may Allah have mercy on him) said, narrating from his paternal uncles: I saw the Messenger of Allah (peace and blessings of Allah be upon him) lying on his back in the mosque, putting one leg on top of the other. (Narrated by Al-Bukhari, 475; Muslim, 2100) 
His mattress was made of leather stuffed with palm fibres, and he had a coarse woollen cloth that he (peace and blessings of Allah be upon him) would fold over twice and sleep on. 
The point is that he slept on a mattress and covered himself with a blanket. He (peace and blessings of Allah be upon him) said to his wives: “Jibril never came to me whilst I was under the blanket of any one of you apart from `Aishah.” (Narrated by Al-Bukhari, 3775)
His pillow was also leather stuffed with palm fibres. 
Du`a before sleeping
When he went to bed to sleep, he (peace and blessings of Allah be upon him) would say : “Allahumma bismika ahya wa amut (O Allah, in Your name I live and die).” (Narrated by Al-Bukhari, 7394) 
He (peace and blessings of Allah be upon him) used to put his hands together and blow into them, then recite Qul Huwa Allahu ahad , Qul a’udhu bi Rabb il-Falaq and Qul a’udhu bi Rabb in-Nas [i.e., the last three surahs of the Quran), then he would wipe his hands over as much of his body as he could, starting with his head and face, and the front part of his body. He would do that three times. 
Which side did the Prophet sleep on?
He (peace and blessings of Allah be upon him) used to sleep on his right side , putting his right hand under his right cheek, then he would say: “Allahumma qini ‘adhabaka yawma tab’ath ‘ibadaka (O Allah, protect me from Your punishment on the Day You resurrect Your slaves).” 
When he went to bed he (peace and blessings of Allah be upon him) used to say: “Al-hamdu Lillah alladhi at’amana wa saqana wa kafana wa awana, fakam mimman la kaafi lahu wa la mu’wi (All praise is for Allah, Who fed us and gave us to drink, and Who is sufficient for us and has sheltered us, for how many have none to suffice them or shelter them).” 
This was narrated by Muslim, who also narrated that he (peace and blessings of Allah be upon him) used to say when he went to bed: 
“Allahumma Rabb As-samawati wa’l-ard wa Rabb Al-‘arsh il-‘athim, Rabbana wa Rabba kulli shay’in, Faliq Al-habb wa’n-nawa wa munzil Al-Tawrati wa’l-Injili wa’l-Furqan, a’udhu bika min sharri kulli shay’in anta akhidhun bi nasiyatihi. Allahumma anta Al-Awwal falaysa qablaka shay’un, wa anta Al-Akhir falaysa ba’daka shay’un, wa anta Ath-Thaahir falaysa fawqaka shay’un wa anta Al-Baatin falaysa doonaka shay’un. Iqdi ‘anna Ad-dayna wa aghnina min Al-faqri (O Allah, Lord of the seven heavens and the exalted Throne, our Lord and Lord of all things, splitter of the seed and the date-stone, Revealer of the Tawrat and the Injil and the Furqan [Quran], I seek refuge in You from the evil of all things You shall seize by the forelock [have total mastery over]. O Allah, You are the First so there is nothing before You, and You are the Last so there is nothing after You. You are Ath-Thaahir [the greatest and highest] so there is nothing above You, and You are Al-Baatin [aware of the subtlest secrets] so there is nothing closer than You. Settle our debt for us and spare us from poverty).” (Narrated by Muslim) 
Du`a after waking up
When he woke up from sleep he (peace and blessings of Allah be upon him) would say: “Al-hamdu Lillah alladhi ahyana ba’d ma amatana wa ilayhi Al-nushuor (Praise be to Allah Who has brought us back to life after causing us to die, and unto Him is the resurrection).” (Narrated by Al-Bukhari, 6312). Then he (peace and blessings of Allah be upon him) would clean his teeth using the Miswak, and recite the last ten verses from Surat Al ‘Imran, from the verse (interpretation of the meaning):  
“Verily, in the creation of the heavens and the earth…” [Aal ‘Imran 3:190-200]
He (peace and blessings of Allah be upon him) would also say: “Allahumma laka Al-hamd anta nur As-samawaati wa’l-ard wa man fihinna, wa laka Al-hamd anta qayyum us-samawati wa’l-ard wa man fihinna, wa laka Al-hamd anta Al-haqq wa wa’duka Al-haqq wa liqa’uka haqq wa’l-jannatu haqq wa’n-naru haqq wa’n-nabiyuna haqq wa Muhammadun haqq wa’s-sa’atu haqq. Allahumma laka aslamtu wa bika amantu wa ‘alayka tawakkaltu wa ilayka anabtu wa bika khasamtu wa ilayka hakamtu, faghfir li ma qaddamutu wa ma akhartu wa ma asrartu wa ma a’lantu anta ilahi la ilaha illa anta (O Allah, to You be praise, You are the Light of the heavens and the earth and everyone in them. To You be praise, You are the Sustainer of the heavens and the earth and everyone in them. To You be praise, You are the Truth (Al-Haqq), Your promise is true, the meeting with You is true, Paradise is true, Hell is true, the Prophets are true, Muhammad is true  and the Hour is true. O Allah, to You I submit myself, in You I believe, in You I put my trust, to You I repent, by Your help I strive (against Your enemies) and to You I refer for judgement, so forgive me my past and future sins, what I do in secret and what I do openly. You are my God and there is no god worthy of worship but You).” (Narrated by Al-Bukhari, 1120) 
Prophet Muhammad’s sleep routine
He (peace and blessings of Allah be upon him) used to sleep during the first part of the night and get up to pray during the last part. Sometimes he would stay up late to deal with the interests of the Muslims. His eyes slept but his heart did not. When he (peace and blessings of Allah be upon him) slept, they (his family) would not wake him up; he would be the one to wake up.
When he (peace and blessings of Allah be upon him) stopped to rest at night during a journey, he would lie down on his right side, and if he stopped to rest just before dawn he would prop his head up on his forearm, resting it in his palm. This was narrated by At-Tirmidhi. 
How many hours did the Prophet sleep?
Prophet Muhammad’s sleep  (peace and blessings of Allah be upon him) was of the best length and it was the most beneficial of sleep. The doctors say that it is one-third of the night and day, namely eight hours.