Shama-il Tirmidhi Chapter 042, Hadith Number 002 (282).

Anas Radiyallahu 'Anhu reports: "Someone was asked about the saum of Rasulullah Sallallahu 'Alayhi Wasallam? He replied: 'It was his noble habit to fast on different occasions. In some months he fasted for so many days, that it was thought he would continue fasting. In other months he did not fast, we thought he would not fast now. It was also from his noble habits that if one wanted to observe Rasulullah Sallallahu 'Alayhi Wasallam performed salaah at night, it was possible, and if one wanted to observe Rasulullah Sallallahu 'Alayhi Wasallam sleep at night, this too was possible'".

Commentary
The object here is that the noble habit of Sayyidina Rasulullah Sallallahu 'Alayhi Wasallam was not to sleep the whole night, neither to remain awake the full night, but adopt a middle course, wherein the rights of the nafs were considered, and also the 'ibaadaat were given its full importance.

Therefore it was possible to observe his sleep at night as he retired for a portion of the night, and also observed the salaah, as part of the night was devoted to prayers. Some of the 'ulama have given another explanation to this, that the noble habit of Sayyidina Rasulullah Sallallahu 'Alayhi Wasallam varied in this respect. At times he performed the nawaafil in the first portion of the night. Sometimes in the middle portion of the night. At times in the last portion of the night. Therefore, if one wanted to observe sleep or salaah at a special time of the night, this too was possible. If one feels that one would like to observe the salaah of Sayyidina Rasulullah Sallallahu 'Alayhi Wasallam at a certain part of the night, then this opportunity could also be obtained, and if one wished to observe the sleep at this time an opportunity could also be obtained at some time. Sayyidina Rasulullah Sallallahu 'Alayhi Wasallam would rotate the time spent in prayer to every portion of the night on different days. We understand two benefits of this. The first is that the main object is worship, and man was created for this reason, resulting in attaining the pleasure of Allah. On every portion of the night, at one time or another, the blessings will be obtained. The second is, that when 'Ibaadah (devotion) is confined to an appointed time, it becomes a sort of habit, then the taste and pleasantness of hardship does not remain. When 'ibaadah is performed at different times of the night it will not become a habit.