This is a very recent question, and it's a somewhat tricky one to answer.
I spent a large amount of time from the age of 13 to 16 feeling suicidal, and most days from the age of 14 to 17 self harming. It's now been over two years since I last took an overdose, and this month marks two years since I stopped self harming. That's not to say I don't still struggle - I do. If I'm having a rough time with anxiety or depression, fighting the "need" to self harm is still tough.
When it comes to suicidal behaviour, I think I kind of scared myself into recovery. I took an overdose at 3am on December 12th 2013 and went to bed. After a while it occurred to me that I still had an awful lot to live for, and I tried to get up to get help, but I had absolutely no strength. I couldn't stand up. I couldn't even move. Also I could do was lie in bed until I passed out.
I was lucky enough to wake up the following day, and since then, any time I've been extremely low, I've thought of that night and how scared I was that I wouldn't wake up.
With the self harm, I think it was pure willpower. The only way I can think to describe it is it's like quitting smoking. It had become an addiction for me. I needed to self harm to feel good, and the more I self harmed the more I needed to in order to get a "hit". Stopping wasn't easy, and for about a year and a half I kept a selection of blades as a "safety net" of sorts. Two years on, I've done away with the safety net and I'm doing pretty well.
With anxiety and depression there's no recovery for me. I still struggle, I've accepted that I probably always will, and I'm taking each day as it comes. Honestly, I'm almost glad of my illness. It's given me empathy, and it was probably my experience of staying "in control" that got me through the emotional aftermath of sexual assault.
How about you? Are you in recovery? What helps you stay on track?