كتاب الإيمان
1  
The Book of Faith
(47)
Chapter: Clarifying the emphatic prohibition against killing oneself; The one who kills himself with something will be punished with it in the fire; And that no one will enter Paradise but a muslim
(47)
باب غِلَظِ تَحْرِيمِ قَتْلِ الإِنْسَانِ نَفْسَهُ وَإِنَّ مَنْ قَتَلَ نَفْسَهُ بِشَيْءٍ عُذِّبَ بِهِ فِي النَّارِ وَأَنَّهُ لاَ يَدْخُلُ الْجَنَّةَ إِلاَّ نَفْسٌ مُسْلِمَةٌ
Sahih Muslim 113 b

It is reported on the authority of Hasan:

Jundab b. 'Abdullah al-Bajali narrated this hadith in this mosque which we can neither forget and at the same time we have no apprehension that Jundab could attribute a lie to the Messenger of Allah (ﷺ). He (the Holy Prophet) observed: A person belonging to the people of the past suffered from a boil, and then the rest of the hadith was narrated.
وَحَدَّثَنَا مُحَمَّدُ بْنُ أَبِي بَكْرٍ الْمُقَدَّمِيُّ، حَدَّثَنَا وَهْبُ بْنُ جَرِيرٍ، حَدَّثَنَا أَبِي قَالَ، سَمِعْتُ الْحَسَنَ، يَقُولُ حَدَّثَنَا جُنْدَبُ بْنُ عَبْدِ اللَّهِ الْبَجَلِيُّ، فِي هَذَا الْمَسْجِدِ فَمَا نَسِينَا وَمَا نَخْشَى أَنْ يَكُونَ جُنْدَبٌ كَذَبَ عَلَى رَسُولِ اللَّهِ صلى الله عليه وسلم قَالَ قَالَ رَسُولُ اللَّهِ صلى الله عليه وسلم ‏ "‏ خَرَجَ بِرَجُلٍ فِيمَنْ كَانَ قَبْلَكُمْ خُرَاجٌ ‏"‏ ‏.‏ فَذَكَرَ نَحْوَهُ ‏.‏
Reference : Sahih Muslim 113b
In-book reference : Book 1, Hadith 215
USC-MSA web (English) reference : Book 1, Hadith 208
  (deprecated numbering scheme)