It is not a long post, in fact is just long enough to give a good idea of the situation.
I'm afraid that even with your friendship which is very supportive that your freind does need medical treatment. To always put himself down, avoid looking at test scores, expecting the worst of the girl, thinking nobody likes him and only being happy with the dog for a short time is not good.
Worse is talk of suicide, even if he says he will not do it.
First things first, which is you. Your actions have been spot-on, and no, there is absolutely nothing to have regrets about, you have done more than could be expected. It is a very stressful time for you as you have not only to worry about his mental state, but must also have fear he might in fact take his life. That is too much for anyone to bear alone.
You said you thought his parents had some idea - maybe they do, though maybe they do not know how serious matters are, after all kids do not often tell their parents things like this. Do you think you might put them in the picture? I know your freind might not appreciate it now, but friendship can return when he is coping better. If you don't think you can, is there anyone else? Maybe a teacher you get on well with perhaps?
What sorts of supports do you have? For instance do you have a strong freind you could talk frankly with, and lean on. Are you parents, mum or dad or other family member approachable, and will they give you the support you need?
Like Sophie says if you are ever in any doubt what to do ring the Kids Help Line who give advice to people in your situation.They do more than you would expect and do give advice to those who are worried of others, They have phone, chat and more. You can talk to them more than once without having to keep explaining.
The one exception is if you think your freind is about to hurt himself or someone else -then ring 000, it is not a betrayal, it is simply a means of keeping a person alive.
I know this is difficult, please come back and talk some more