I'm genuinely glad you were able to pull yourself back, but I agree with a pp that this could be dangerous advice for some, there is no one-size-fits-all with depression. Talking therapies can work, but they can also do a lot more harm than good when administered by someone who isn't fit to be in the job. Personally I ended up in a worse state after CBT due to the 'therapist' making various judgemental and triggering comments during sessions, then looking at me blankly when I asked for advice on processing some of the stuff that had caused my depression to spike (and which she had just been judging me on).
Plus, as far as sleep is concerned, mental health conditions tend to worsen sleep (I dare say you may have experienced this yourself) plus it isn't as simple for some of us as 'getting' enough sleep, for some of us sleep disorders make this difficult/impossible, the demands of day-to-day life can get in the way too.
I know I sound very negative on this thread, so I will just say that I have applied some of the strategies discussed on this thread and found them moderately helpful, I can see that they might suffice to get a person out of a mild funk or a down period, but not severe depression which is a medical condition. What worries me about threads like this is that a lot of people fail to distinguish between the two (I don't mean you pp, it sounds like you have been through the mill) and other pps chatting shit about laundry and the life-changing magic of daily work risks making people feel that they're failing at life if they can't magic themselves out of depression via the simple joy of feeling the sun on their face. It's bullshit, to put it bluntly, and depressingly (pardon the pun) close to the old 'pull yourself together' mindset that I thought most people had educated themselves out of decades ago imo.
Clinical depression is an illness, and like many other illnesses it frequently won't improve without meds to correct the problem, and for people to claim there's no need for them is wrong-headed and, yes, dangerous. I can tell some people on this thread don't want to hear it, but for some of us meds are the sticking plaster you'd put on a broken leg i.e. the problem can't be corrected without them.