Shama-il Tirmidhi Chapter 20, Hadith Number 2 (121).

The uncle of ‘Abbaad bin Tamim, ‘Abdullah bin Zayd Radiyallahu ‘Anhu reports: “I have seen Rasulullah Sallallahu ‘Alayhi Wasallam lying flat on his back in the masjid, with one leg resting on the other.

In a narration of Sahih Muslim it has been prohibited to sleep in this manner. The ulma have summed up both narrations in different ways. A simple explanation is that there are two different postures of sleeping referred to in this manner, both of which have been verified in separate ahaadith. The first is to put the legs flat and rest the one leg on the other. This manner has been mentioned in the ‘Shamaa-il’, and there is no harm in adopting it. The second manner is to lie with both knees raised, then rest on leg on another. This verifies the narration of Sahih Muslim. The reason for Sayyidina Rasulullah Sallallahu ‘Alayhi Wasallam prohibiting the second manner is because the lungi was generally worn in ‘Arabia at that time, and it is very likely that the private parts would be exposed in this manner. It has also been argued here that this hadith is not relevant to the sitting of Sayyidina Rasulullah Sallallahu ‘Alayhi Wasallam. The ulama give different reasons for this. The simplest one is that in this chapter on sitting, the general meaning of both sitting and lying down is taken, although some of the narrations on lying down will be mentioned in the chapter on sleeping. It may also be possible, as Ibn Hajar has explained, that this type of sleeping (despite being prohibited in the narration) is permissible in the masjid. Therefore to sit in different postures should also be permissible.