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

In the hadith narrated by Shu'ba the words are:

Verily the Messenger of Allah (ﷺ) said: He who took an oath on a religion other than Islam as a liar would become so as he said, and he who slaughtered himself with a thing would be slaughtered with that on the Day of Resurrection.
وَحَدَّثَنَا مُحَمَّدُ بْنُ رَافِعٍ، عَنْ عَبْدِ الرَّزَّاقِ، عَنِ الثَّوْرِيِّ، عَنْ خَالِدٍ الْحَذَّاءِ، عَنْ أَبِي قِلاَبَةَ، عَنْ ثَابِتِ بْنِ الضَّحَّاكِ، قَالَ قَالَ النَّبِيُّ صلى الله عليه وسلم ‏"‏ مَنْ حَلَفَ بِمِلَّةٍ سِوَى الإِسْلاَمِ كَاذِبًا مُتَعَمِّدًا فَهُوَ كَمَا قَالَ وَمَنْ قَتَلَ نَفْسَهُ بِشَىْءٍ عَذَّبَهُ اللَّهُ بِهِ فِي نَارِ جَهَنَّمَ ‏"‏ ‏.‏ هَذَا حَدِيثُ سُفْيَانَ ‏.‏ وَأَمَّا شُعْبَةُ فَحَدِيثُهُ أَنَّ رَسُولَ اللَّهِ صلى الله عليه وسلم قَالَ ‏"‏ مَنْ حَلَفَ بِمِلَّةٍ سِوَى الإِسْلاَمِ كَاذِبًا فَهُوَ كَمَا قَالَ وَمَنْ ذَبَحَ نَفْسَهُ بِشَىْءٍ ذُبِحَ بِهِ يَوْمَ الْقِيَامَةِ ‏"‏ ‏.‏
Reference : Sahih Muslim 110d
In-book reference : Book 1, Hadith 211
USC-MSA web (English) reference : Book 1, Hadith 204
  (deprecated numbering scheme)