كتاب الإمارة
33  
The Book on Government
(46)
Chapter: It is recommended to seek Martyrdom in the Cause of Allah, Exalted is He.
(46)
باب اسْتِحْبَابِ طَلَبِ الشَّهَادَةِ فِي سَبِيلِ اللَّهِ تَعَالَى ‏‏
Sahih Muslim 1909

It has been reported on the authority of Sahl b. Aba Umama b. Sahl b. Hunaif who learned the tradition from his father who (in turn) learned it from his grandfather-that the Messenger of Allah (ﷺ) said:

Who sought martyrdom with sincerity will be ranked by Allah among the martyrs even if he died on his bed. In his version of the tradition Abd Tahir did not mention the words:" with sincerity".
حَدَّثَنِي أَبُو الطَّاهِرِ، وَحَرْمَلَةُ بْنُ يَحْيَى، - وَاللَّفْظُ لِحَرْمَلَةَ - قَالَ أَبُو الطَّاهِرِ أَخْبَرَنَا وَقَالَ، حَرْمَلَةُ حَدَّثَنَا عَبْدُ اللَّهِ بْنُ وَهْبٍ، حَدَّثَنِي أَبُو شُرَيْحٍ، أَنَّ سَهْلَ بْنَ أَبِي أُمَامَةَ بْنِ سَهْلِ، بْنِ حُنَيْفٍ حَدَّثَهُ عَنْ أَبِيهِ، عَنْ جَدِّهِ، أَنَّ النَّبِيَّ صلى الله عليه وسلم قَالَ ‏"‏ مَنْ سَأَلَ اللَّهَ الشَّهَادَةَ بِصِدْقٍ بَلَّغَهُ اللَّهُ مَنَازِلَ الشُّهَدَاءِ وَإِنْ مَاتَ عَلَى فِرَاشِهِ ‏"‏ ‏.‏ وَلَمْ يَذْكُرْ أَبُو الطَّاهِرِ فِي حَدِيثِهِ ‏"‏ بِصِدْقٍ ‏"‏ ‏.‏
Reference : Sahih Muslim 1909
In-book reference : Book 33, Hadith 225
USC-MSA web (English) reference : Book 20, Hadith 4695
  (deprecated numbering scheme)