All perfect praise be to Allaah, The Lord of the Worlds. I testify that there is none worthy of worship except Allaah, and that Muhammad is His slave and Messenger.
First of all, we ask Allaah to safeguard and protect us all in our religion and worldly affairs, and bless us with a good ending and enable us to stay away from sins.
You should know that the matter is easy since you realized that these are bad thoughts; this is a good sign from you and a proof of your good belief. The thoughts which you have are no more than the whispers of the devil. We praise Allaah who restricted the plots of the devil to whispering only. The Prophet said: "The devil would come to one of you and would whisper to him: ''Who created so and so?; until he whispers to him: ''Who created your Lord (Allaah)? If a person finds these whispers, he should seek refuge in Allaah from the devil and stop thinking about this.'' [Al-Bukhari and Muslim]. This narration is evidence that one is not sinful for having these whispers but he is obliged to seek refuge in Allaah from them and not continue to think about them or be content with them. For more benefit, please refer to Fataawa 91084, 86235 and 88297.
We advise you to keep company with righteous women and attend lectures and circles of knowledge. You should earnestly mention Allaah and recite the Quran as much as possible, and perform Ruqyah on yourself, and it is permissible for a righteous person to perform Ruqyah on you.
As regards committing suicide, then this is a heinous and abominable act which you are forbidden to think about, let alone committing it. Suicide does not solve any problem but leads a person to disgrace and regret. You should read about the threat which is reported about it. For instance, the Prophet said: "Whoever kills himself with an iron weapon, will be carrying that weapon in his hand and stabbing his abdomen with it in Hellfire wherein he will abide eternally; and whoever drinks poison and kills himself with it, he will be carrying his poison in his hand and drinking it in Hellfire wherein he will abide eternally; and whoever purposely jumps from a mountain and kills himself, will be in Hellfire falling down into it and abiding therein perpetually forever." For more benefit, please refer to Fatwa 84296.
Allaah Knows best.