(a) Sayyiduna Jabir bin Abdullah (may Allah be pleased with them both) narrates that the Messenger of Allah (peace and blessings be upon him) forbade ishtimal al-samma, sitting with the knees drawn up (ihtiba') in a single garment, and a man lifting one of his legs and placing it over the other while lying on his back.
(b) It is likely that the prohibition of a man lifting one leg and placing it over the other while lying down is because of the exposure of the private area, for when a man lying down lifts one leg over the other while wearing a tight waist-wrapper, he will not be safe from something being exposed, and the thigh itself is part of the private area. So if the waist-wrapper is ample, or the one wearing it guards against exposure, there is no harm in it. This was said by Abu Sulayman al-Khattabi (may Allah have mercy on him).
Hadith Referenceالسنن الكبرى للبيهقي / كتاب الصلاة / 3209