Sunan Abi Dawud, Book 8, Hadith 1442 (USC-MSA) ⓘ
Zaid b. Thabit said: The Messenger of Allah built a chamber in the mosque. He used to come out at night and pray there. They (the people) also prayed along with him. They would come (to prayer) every night. If on any night the Messenger of Allah did not come out, they would cough, raise their voices and throw pebbles and sand on his door. The Messenger of Allah came out to time in anger and said: O People, you kept on doing this till I thought that it will be prescribed for you. Offer your prayers in your houses, for a man's prayer is better in his house except obligatory prayer.
حَدَّثَنَا هَارُونُ بْنُ عَبْدِ اللَّهِ الْبَزَّازُ، حَدَّثَنَا مَكِّيُّ بْنُ إِبْرَاهِيمَ، حَدَّثَنَا عَبْدُ اللَّهِ، - يَعْنِي ابْنَ سَعِيدِ بْنِ أَبِي هِنْدٍ - عَنْ أَبِي النَّضْرِ، عَنْ بُسْرِ بْنِ سَعِيدٍ، عَنْ زَيْدِ بْنِ ثَابِتٍ، أَنَّهُ قَالَ احْتَجَرَ رَسُولُ اللَّهِ صلى الله عليه وسلم فِي الْمَسْجِدِ حُجْرَةً فَكَانَ رَسُولُ اللَّهِ صلى الله عليه وسلم يَخْرُجُ مِنَ اللَّيْلِ فَيُصَلِّي فِيهَا قَالَ فَصَلَّوْا مَعَهُ بِصَلاَتِهِ - يَعْنِي رِجَالاً - وَكَانُوا يَأْتُونَهُ كُلَّ لَيْلَةٍ حَتَّى إِذَا كَانَ لَيْلَةً مِنَ اللَّيَالِي لَمْ يَخْرُجْ إِلَيْهِمْ رَسُولُ اللَّهِ صلى الله عليه وسلم فَتَنَحْنَحُوا وَرَفَعُوا أَصْوَاتَهُمْ وَحَصَبُوا بَابَهُ - قَالَ - فَخَرَجَ إِلَيْهِمْ رَسُولُ اللَّهِ صلى الله عليه وسلم مُغْضَبًا فَقَالَ " يَا أَيُّهَا النَّاسُ مَا زَالَ بِكُمْ صَنِيعُكُمْ حَتَّى ظَنَنْتُ أَنْ سَتُكْتَبَ عَلَيْكُمْ فَعَلَيْكُمْ بِالصَّلاَةِ فِي بُيُوتِكُمْ فَإِنَّ خَيْرَ صَلاَةِ الْمَرْءِ فِي بَيْتِهِ إِلاَّ الصَّلاَةَ الْمَكْتُوبَةَ " .
also referenced under: Hadith 1447 (DarusSalam) & Hadith 1442 (Hasan)