Zayd bin Thabit reported,

The Messenger of Allah ﷺ partitioned off a small enclosure for himself in the mosque. He used to come out at night and pray inside it, and Some men would join him in his prayer. They kept coming to him every night, until one night the Messenger of Allah ﷺ did not come out to them. They began clearing their throats and raising their voices.The Messenger of Allah ﷺ then came out to them angrily and said, "People, you persisted in what you were doing until I feared it would be prescribed upon you. So pray in your houses, for the best prayer a person performs is in his house, except for the obligatory prayer."

Ahmad 21632

Sahih

حدثنا مكي حدثنا عبد الله بن سعيد بن أبي هند عن أبي النضر عن بسر بن سعيد

عن زيد بن ثابت الأنصاري قال

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

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