كتاب الإيمان
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 a

It is reported on the authority of Hasan:

A person belonging to the people of the past suffered from a boil, when it pained him, he drew out an arrow from the quiver and pierced it. And the bleeding did not stop till he died. Your Lord said: I forbade his entrance into Paradise. Then he (Hasan) stretched his hand towards the mosque and said: By God, Jundab transmitted this hadith to me from the Messenger of Allah (ﷺ) in this very mosque.
حَدَّثَنِي مُحَمَّدُ بْنُ رَافِعٍ، حَدَّثَنَا الزُّبَيْرِيُّ، - وَهُوَ مُحَمَّدُ بْنُ عَبْدِ اللَّهِ بْنِ الزُّبَيْرِ - حَدَّثَنَا شَيْبَانُ، قَالَ سَمِعْتُ الْحَسَنَ، يَقُولُ ‏ "‏ إِنَّ رَجُلاً مِمَّنْ كَانَ قَبْلَكُمْ خَرَجَتْ بِهِ قَرْحَةٌ فَلَمَّا آذَتْهُ انْتَزَعَ سَهْمًا مِنْ كِنَانَتِهِ فَنَكَأَهَا فَلَمْ يَرْقَإِ الدَّمُ حَتَّى مَاتَ ‏.‏ قَالَ رَبُّكُمْ قَدْ حَرَّمْتُ عَلَيْهِ الْجَنَّةَ ‏"‏ ‏.‏ ثُمَّ مَدَّ يَدَهُ إِلَى الْمَسْجِدِ فَقَالَ إِي وَاللَّهِ لَقَدْ حَدَّثَنِي بِهَذَا الْحَدِيثِ جُنْدَبٌ عَنْ رَسُولِ اللَّهِ صلى الله عليه وسلم فِي هَذَا الْمَسْجِدِ ‏.‏
Reference : Sahih Muslim 113a
In-book reference : Book 1, Hadith 214
USC-MSA web (English) reference : Book 1, Hadith 207
  (deprecated numbering scheme)