A man came to the Messenger of Allah ﷺ and said, "Messenger of Allah, hardship has befallen me."So he sent word to his wives, but found nothing with them. The Messenger of Allah ﷺ then said, "Is there no man who will host this person tonight, that Allah may have mercy on him?"A man from the Ansar stood up and said, "I will, Messenger of Allah."He went to his family and said to his wife, "This is the guest of the Messenger of Allah ﷺ. Do not hold anything back from him."She said, "By Allah, I have nothing but the children's food."He said, "When the children want their dinner, put them to sleep. Then come and put out the lamp, and we will tighten our bellies tonight."So she did. Then the man went the next morning to the Messenger of Allah ﷺ, who said, "Allah marveled," or "Allah laughed at what so-and-so and his wife did last night." And Allah
revealed, "They give preference over themselves, even though they are in need" [Hashr 59:9].
أتى رجل رسول الله ﷺ فقال: يا رسول الله، أصابني الجهد، فأرسل إلى نسائه فلم يجد عندهن شيئا، فقال رسول الله ﷺ: ألا رجل يضيف هذه الليلة، يرحمه الله. فقام رجل من الأنصار فقال: أنا يا رسول الله، فذهب إلى أهله فقال لامرأته: ضيف رسول الله ﷺ لا تخبريه شيئا. قالت: والله ما عندي إلا قوت الصبية، قال: فإذا أراد الصبية العشاء فنوميهم وتعالي فأطفئي السراج، ونطوي بطوننا الليلة، ففعلت، ثم غدا الرجل على رسول الله ﷺ، فقال: لقد عجب الله عز وجل أو ضحك من فلان وفلانة. فأنزل الله عز وجل: {ويؤثرون على أنفسهم ولو كان بهم خصاصة} [سورة الحشر: ٩].
Bukhari reported it in the Virtues of the Ansar (3798) and in the Tafsir (4889), and Muslim in the Book of Drinks (2054), both from the hadith of Fudayl bin Ghazwan, from Abu Hazim, from Abu Hurairah, who related it. The wording given is Bukhari's, and Muslim's wording is similar.