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. (Using translation from Abū Dāʾūd 1447)
احْتَجَرَ رَسُولُ اللهِ ﷺ حُجْرَةً فِي الْمَسْجِدِ فَكَانَ يُصَلِّي فِيهَا فَرَآهُ رَجُلٌ فَصَلُّوا بِصَلَاتِهِ حَتَّى إِذَا كَانَتْ لَيْلَةٌ حَضَرُوهُ وَهُوَ لَمْ يَخْرُجْ إِلَيْهِمْ فَتَنَحْنَحُوا وَحَصَبُوا الْبَابَ وَرَفَعُوا أَصْوَاتَهُمْ فَخَرَجَ إِلَيْهِمْ رَسُولُ اللهِ ﷺ مُغْضَبًا فَقَالَ «أَيُّهَا النَّاسُ مَا زَالَ بِكُمْ صَنِيعُكُمْ حَتَّى ظَنَنْتُ أَنَّهُ سَتُكْتَبُ فَعَلَيْكُمْ بِالصَّلَاةِ فِي بُيُوتِكُمْ فَإِنَّ خَيْرَ صَلَاةِ الْمَرْءِ فِي بَيْتِهِ إِلَّا الْمَكْتُوبَةَ»