There is no doubt that committing suicide is a forbidden act and one of the major sins. Allah The Exalted warns the person who commits suicide that He will be tortured in the Hereafter. Allah The Almighty Says (what means): “And do not kill yourselves [or one another]. Indeed, Allah is to you ever Merciful” (Quran 4:29)
There are also several Hadeeths on the punishment of the person who commits suicide:
It was narrated on the authority of Thaabit ibn Adh-Dhahhaak that the Prophet , said that whoever commits suicide by any means will be punished with it [by the same means] in Hell. (Al-Bukhari and Muslim)
It was narrated on the authority of Abu-Hurayrah that the Prophet , said that the person who commits suicide by throttling or stabbing himself will be tortured in that way in Hell.
It was narrated on the authority of Abu-Hurayrah that the Prophet , said that whoever throws himself from a mountain on purpose and kills himself, will be in Hell, falling down into it and abiding therein forever; and whoever drinks poison and kills himself with it, will be carrying that poison in his hand and drinking it in Hell wherein he would dwell for eternity; and whoever kills himself with an iron weapon, will be carrying that weapon in his hand and stabbing his abdomen with it in Hell, wherein he would dwell for eternity. (Muslim)
There is a difference of opinion among scholars with regard to whether or not the person who commits suicide will be doomed to be in Hell forever.
This difference originated from two considerations:
1- The fact that the sin of committing suicide, regardless of how major and heinous it is, is less than the sin of disbelieving in Allah The Almighty or associating partners with Him.
2- The phrase "eternally" or " forever" mentioned in the previous Hadeeth that was narrated by Imam Muslim was not mentioned in Al-Bukhari's narration of the same Hadeeth.
Deviant groups like the Mu‘tazilah and Khawaarij use this phrase as evidence to support their opinion that a Muslim sinner will be doomed to be in Hell forever. However, the Sunnis combine the two versions of the Hadeeth, indicating that whoever testifies that none is truly worthy of worship but Allah The Almighty will eventually enter Paradise, concluding that sinful Muslims will not be doomed to be in Hell forever.
The Sunni scholars comment on the phrase "eternally" or "forever" that was mentioned in the narration of Imam Muslim saying that:
• Some scholars maintain that this phrase is unauthentic (only this phrase not the entire Hadeeth).
• Other scholars consider that this phrase applies to the person who commits suicide considering it a lawful act while he knows that it is certainly prohibited in the Shariah (Islamic legislation). In such a case, this person will be doomed to be in Hell forever, not because he committed suicide but because he became a disbeliever by considering lawful what is unarguably unlawful.
• Some scholars said that this phrase is not to be taken literally, but it is an exaggeration aimed to deter people from committing suicide.
• Some scholars said that this phrase refers to the punishment, which the one who commits suicide deserves, yet Allah The Merciful ultimately saves the monotheistic Muslim from being doomed to be in Hell forever. This opinion reconciles all the seemingly contradictory Hadeeths in this regard.
• Some scholars said that this phrase is made conditional to the Will of Allah The Almighty, that is, the person who commits suicide will be doomed to be to in Hell forever unless Allah The Almighty chooses to save him.
The summary is that the Ahl-us-Sunnah believe that sinful Muslims, including those who commit suicide, will not be doomed to be in Hell forever.
And Allah Knows best.
Recommended Reading about Suicide in Islam
Islamic Solutions for Depression (Article - extensive, goes into types of depression too)