I know that it can be scary to see someone you care about going through similar things that you have gone through. All you hope for is that you can make it all go away from them, but at the end of the day all you can do is to just be there for them.
You said you've gone through the same things in the past, perhaps you could think about what sorts of things helped you when you weren't doing well. Other than that just letting him know that you are there for him if he needs to talk or to just hang out with you and do random things when he is feeling down. You could also bring up getting help from professionals to him unless he is already doing that.
Anyways, I'm sorry if I haven't been much help. I hope your boyfriends starts to feel better soon.
Take care :)