He said that the Messenger of Allah ﷺ partitioned off a small enclosure within the mosque. The Messenger of Allah ﷺ would come out at night and pray inside it. Some men prayed along with him following his prayer, and they kept coming to him every night.Then one night the Messenger of Allah ﷺ did not come out to them. They began clearing their throats, raising their voices, and tossing pebbles at his door. The Messenger of Allah ﷺ came out to them angry and said, "People, you have continued doing this until I feared that it would be made obligatory upon you. So pray in your homes, for the best prayer a person performs is in his home, except for the prescribed prayer."
حدثنا هارون بن عبد الله البزاز حدثنا مكي بن إبراهيم حدثنا عبد الله يعني ابن سعيد بن أبي هند عن أبي النضر عن بسر بن سعيد
أنه قال احتجر رسول الله ﷺ في المسجد حجرة فكان رسول الله ﷺ يخرج من الليل فيصلي فيها قال فصلوا معه لصلاته يعني رجالا وكانوا يأتونه كل ليلة حتى إذا كان ليلة من الليالي لم يخرج إليهم رسول الله ﷺ فتنحنحوا ورفعوا أصواتهم وحصبوا بابه قال فخرج إليهم رسول الله ﷺ مغضبا فقال يا أيها الناس ما زال بكم صنيعكم حتى ظننت أن ستكتب عليكم فعليكم بالصلاة في بيوتكم فإن خير صلاة المرء في بيته إلا الصلاة المكتوبة
Recorded by Bukhari in "Manners," chapter on when anger and severity are permissible for the sake of Allah Almighty, hadith 6113, from Makki bin Ibrahim, and by Muslim in "Prayer of the Traveler," chapter on the recommendation of performing optional prayers at home and their permissibility in the masjid, etc., hadith 781, from the hadith of Abdullah bin Saeed bin Abu Hind, through him.