Sahih al-Bukhari, Volume 9, Book 93, Hadith 540 (USC-MSA)

Narrated Usama: A son of one of the daughters of the Prophet was dying, so she sent a person to call the Prophet. He sent (her a message), "What ever Allah takes is for Him, and whatever He gives is for Him, and everything has a limited fixed term (in this world) so she should be patient and hope for Allah's reward." She then sent for him again, swearing that he should come. Allah's Messenger got up, and so did Mu`adh bin Jabal, Ubai bin Ka`b and 'Ubada bin As-Samit. When he entered (the house), they gave the child to Allah's Messenger while its breath was disturbed in his chest. (The sub-narrator said: I think he said, "...as if it was a water skin.") Allah's Messenger started weeping whereupon Sa`d bin 'Ubada said, "Do you weep?" The Prophet said, "Allah is merciful only to those of His slaves who are merciful (to others).

حَدَّثَنَا مُوسَى بْنُ إِسْمَاعِيلَ، حَدَّثَنَا عَبْدُ الْوَاحِدِ، حَدَّثَنَا عَاصِمٌ، عَنْ أَبِي عُثْمَانَ، عَنْ أُسَامَةَ، قَالَ كَانَ ابْنٌ لِبَعْضِ بَنَاتِ النَّبِيِّ صلى الله عليه وسلم يَقْضِي، فَأَرْسَلَتْ إِلَيْهِ أَنْ يَأْتِيَهَا فَأَرْسَلَ ‏"‏ إِنَّ لِلَّهِ مَا أَخَذَ، وَلَهُ مَا أَعْطَى، وَكُلٌّ إِلَى أَجَلٍ مُسَمًّى، فَلْتَصْبِرْ وَلْتَحْتَسِبْ ‏"‏‏.‏ فَأَرْسَلَتْ إِلَيْهِ فَأَقْسَمَتْ عَلَيْهِ فَقَامَ رَسُولُ اللَّهِ صلى الله عليه وسلم وَقُمْتُ مَعَهُ وَمُعَاذُ بْنُ جَبَلٍ وَأُبَىُّ بْنُ كَعْبٍ وَعُبَادَةُ بْنُ الصَّامِتِ، فَلَمَّا دَخَلْنَا نَاوَلُوا رَسُولَ اللَّهِ صلى الله عليه وسلم الصَّبِيَّ وَنَفْسُهُ تَقَلْقَلُ فِي صَدْرِهِ ـ حَسِبْتُهُ قَالَ ـ كَأَنَّهَا شَنَّةٌ، فَبَكَى رَسُولُ اللَّهِ صلى الله عليه وسلم فَقَالَ سَعْدُ بْنُ عُبَادَةَ أَتَبْكِي فَقَالَ ‏"‏ إِنَّمَا يَرْحَمُ اللَّهُ مِنْ عِبَادِهِ الرُّحَمَاءَ ‏"‏‏.‏

sunnah.com