I used to sleep in front of the Messenger of Allah ﷺ with my legs stretched toward his prayer direction. When he prostrated, he would tap me and I would draw my legs in, and when he stood up, I would stretch them out again. In those days the houses had no lamps.
أخبرنا قتيبة عن مالك عن أبي النضر عن أبي سلمة
كنت أنام بين يدي رسول الله ﷺ ورجلاي في قبلته فإذا سجد غمزني فقبضت رجلي فإذا قام بسطتهما والبيوت يومئذ ليس فيها مصابيح
Bukhari narrated it in the Book of Prayer, chapter on praying on bedding, hadith no. 382, and Muslim in the Book of Prayer, chapter on lying crosswise in front of one who is praying, hadith no. 272/512, from the hadith of Malik through this route. It is also in Muwatta (Yahya): 1/117, and in Kubra, hadith no. 156.