Zayd bin Thabit reported,

The Prophet ﷺ set up a small enclosure in the mosque made of reed mats and prayed inside it for several nights. People gathered around him, but then they no longer heard his voice and assumed he had fallen asleep. Some of them began clearing their throats hoping he would come out to them.He said, "You kept up what I saw of your behavior until I feared that this prayer might be made obligatory upon you. Had it been made obligatory, you would not have been able to keep it up. So pray in your homes, people, for the best prayer a person offers is in his home, except for the prescribed prayers."

Ahmad 21582

Sahih

قال حدثنا عفان حدثنا وهيب حدثنا موسى بن عقبة قال سمعت أبا النضر يحدث عن بسر بن سعيد

عن زيد بن ثابت

أن النبي ﷺ اتخذ حجرة في المسجد من حصير فصلى فيها رسول الله ﷺ ليالي حتى اجتمع إليه ناس ثم فقدوا صوته فظنوا أنه قد نام فجعل بعضهم يتنحنح ليخرج إليهم فقال ما زال بكم الذي رأيت من صنيعكم حتى خشيت أن يكتب عليكم ولو كتب عليكم ما قمتم به فصلوا أيها الناس في بيوتكم فإن أفضل صلاة المرء في بيته إلا الصلاة المكتوبة

أحمد 21582صحيح
Contents
Reference
Commentary
Ayat
Collection
Musnad Ahmad
Book
Zayd bin Thabit
Numbering
Darussalam 21582
Ahmad 21582