Abdullah bin Saad reported,

I asked the Messenger of Allah ﷺ, "Which is better, praying in my house or praying in the mosque?"He replied, "Do you not see how close my house is to the mosque? Yet praying in my house is more beloved to me than praying in the mosque, unless it is an obligatory prayer."

Ibn Majah 1378

Sahih

حدثنا أبو بشر بكر بن خلف حدثنا عبد الرحمن بن مهدي عن معاوية بن صالح عن العلاء بن الحارث عن حرام بن معاوية

عن عمه عبد الله بن سعد قال

سألت رسول الله ﷺ أيما أفضل الصلاة في بيتي أو الصلاة في المسجد قال ألا ترى إلى بيتي ما أقربه من المسجد فلأن أصلي في بيتي أحب إلي من أن أصلي في المسجد إلا أن تكون صلاة مكتوبة

ابن ماجه 1378صحيح
Contents
Reference
Commentary
Ayat
Collection
Sunan Ibn Majah
Book
Establishing prayer and the sunnah regarding it
Chapter
Voluntary prayers at home
Numbering
Darussalam 1378
Ibn Majah 1378