Language:
كتاب التوحيد
97  
Oneness, Uniqueness of Allah (Tawheed)
(25)
Chapter: “…Surely, Allah’s Mercy is near unto the good-doers.”
(25)
باب مَا جَاءَ فِي قَوْلِ اللَّهِ تَعَالَى ‏{‏إِنَّ رَحْمَةَ اللَّهِ قَرِيبٌ مِنَ الْمُحْسِنِينَ}
Sahih al-Bukhari 7448

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).

حَدَّثَنَا مُوسَى بْنُ إِسْمَاعِيلَ، حَدَّثَنَا عَبْدُ الْوَاحِدِ، حَدَّثَنَا عَاصِمٌ، عَنْ أَبِي عُثْمَانَ، عَنْ أُسَامَةَ، قَالَ كَانَ ابْنٌ لِبَعْضِ بَنَاتِ النَّبِيِّ صلى الله عليه وسلم يَقْضِي، فَأَرْسَلَتْ إِلَيْهِ أَنْ يَأْتِيَهَا فَأَرْسَلَ ‏"‏ إِنَّ لِلَّهِ مَا أَخَذَ، وَلَهُ مَا أَعْطَى، وَكُلٌّ إِلَى أَجَلٍ مُسَمًّى، فَلْتَصْبِرْ وَلْتَحْتَسِبْ ‏"‏‏.‏ فَأَرْسَلَتْ إِلَيْهِ فَأَقْسَمَتْ عَلَيْهِ فَقَامَ رَسُولُ اللَّهِ صلى الله عليه وسلم وَقُمْتُ مَعَهُ وَمُعَاذُ بْنُ جَبَلٍ وَأُبَىُّ بْنُ كَعْبٍ وَعُبَادَةُ بْنُ الصَّامِتِ، فَلَمَّا دَخَلْنَا نَاوَلُوا رَسُولَ اللَّهِ صلى الله عليه وسلم الصَّبِيَّ وَنَفْسُهُ تَقَلْقَلُ فِي صَدْرِهِ ـ حَسِبْتُهُ قَالَ ـ كَأَنَّهَا شَنَّةٌ، فَبَكَى رَسُولُ اللَّهِ صلى الله عليه وسلم فَقَالَ سَعْدُ بْنُ عُبَادَةَ أَتَبْكِي فَقَالَ ‏"‏ إِنَّمَا يَرْحَمُ اللَّهُ مِنْ عِبَادِهِ الرُّحَمَاءَ ‏"‏‏.‏
Reference : Sahih al-Bukhari 7448
In-book reference : Book 97, Hadith 74
USC-MSA web (English) reference : Vol. 9, Book 93, Hadith 540
  (deprecated numbering scheme)