Zayd bin Thabit reported,

The Messenger of Allah ﷺ partitioned off a small enclosure using a woven mat, and the Messenger of Allah ﷺ went out to pray in it. Some men followed him there and came to pray along with his prayer.Then they came one night and waited, but the Messenger of Allah ﷺ was delayed and did not come out to them. They raised their voices and threw pebbles at the door.He came out to them angry and said to them, "Your persistence in this practice has continued until I feared it might be made obligatory upon you. So pray in your homes, for the best prayer a person offers is in his home, except for the prescribed prayer."

Bukhari 6113

Sahih

وقال المكي حدثنا عبد الله بن سعيد ح و حدثني محمد بن زياد حدثنا محمد بن جعفر حدثنا عبد الله بن سعيد قال حدثني سالم أبو النضر مولى عمر بن عبيد الله عن بسر بن سعيد

عن زيد بن ثابت رضي الله عنه قال

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

البخاري 6113صحيح
Contents
Reference
Commentary
Ayat
Collection
Sahih Bukhari
Book
Manners
Chapter
What is permissible of anger and severity for the sake of Allah
Numbering
Darussalam 6113
Bukhari 6113