I used to sleep in front of the Messenger of Allah ﷺ with my legs stretched out toward his prayer direction. When he prostrated, he would nudge 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.
قال قرأت على عبد الرحمن بن مهدي: مالك عن أبي النضر مولى عمر بن عبيد الله عن أبي سلمة بن عبد الرحمن
كنت أنام بين يدي رسول الله ﷺ ورجلي في قبلته فإذا سجد غمزني فقبضت رجلي وإذا قام بسطتهما والبيوت ليس يومئذ فيها مصابيح
Its chain of transmission is sahih. Abu Nadr is Salim bin Abu Umaya, and he is trustworthy, his hadith is found in the collections of the group. The hadith was narrated by Bukhari 1/491 no. 382 (Fath), and Muslim 1/367 no. 512, both in the chapter on prayer, and it has come up many times before.