The Prophet ﷺ took a room made of date palm leaves mats in the mosque. Messenger of Allah ﷺ prayed in it for a few nights till the people gathered (to pray the night prayer (Tarawih) (behind him.) Then on the 4th night the people did not hear his voice and they thought he had slept, so some of them started humming in order that he might come out. The Prophet ﷺ then said, "You continued doing what I saw you doing till I was afraid that this (Tarawih prayer) might be enjoined on you, and if it were enjoined on you, you would not continue performing it. Therefore, O people! Perform your prayers at your homes, for the best prayer of a person is what is performed at his home except the compulsory congregational) prayer." (See Hadith No. 229,Vol. 3) (See Hadith No. 134, Vol. 8) (Using translation from Bukhārī 7290)
أَنَّ النَّبِيَّ ﷺ اتَّخَذَ حُجْرَةً فِي الْمَسْجِدِ مِنْ حَصِيرٍ فَصَلَّى فِيهَا رَسُولُ اللهِ ﷺ حَتَّى اجْتَمَعَ إِلَيْهِ نَاسٌ ثُمَّ فَقَدُوا صَوْتَهُ فَظَنُّوا أَنَّهُ قَدْ نَامَ فَجَعَلَ بَعْضُهُمْ يَتَنَحْنَحُ لِيَخْرُجَ إِلَيْهِمْ فَقَالَ مَا زَالَ بِكُمُ الَّذِي رَأَيْتُ مِنْ صَنِيعِكُمْ حَتَّى خَشِيتُ أَنْ يُكْتَبَ عَلَيْكُمْ وَلَوْ كُتِبَ عَلَيْكُمْ مَا قُمْتُمْ بِهِ فَصَلُّوا أَيُّهَا النَّاسُ فِي بُيُوتِكُمْ فَإِنَّ أَفْضَلَ صَلَاةِ الْمَرْءِ فِي بَيْتِهِ إِلَّا الصَّلَاةَ الْمَكْتُوبَةَ