I can definitely sympathize with your situation. I suffer from DSPS and a melatonin deficiency which makes it impossible to sleep without nightly doses of Rozerem, which is a synthesized melatonin. My sleep difficulties did not manifest until age 17, and made the next 6 years miserable until I spoke to a doctor who realized what was going on.

An earlier Ask HN talked about overcoming poor sleep: http://news.ycombinator.com/item?id=205153 I have a post in that topic which details a lot of my experiences with sleeping difficulties.

There is some great information on basic sleep hygiene in today's Ask HN which covers the basics. It's great that you had a PSG performed. Ruling out Sleep Apnea and RLS is a great start for finding out what is actually happening. I know that I tried a half dozen sedative prescription sleeping medications which did absolutely nothing for me before trying the Rozerem. Rozerem is not a sedative but a synthesized hormone which binds to your melatonin receptors. Melatonin is key in regulating the sleep/wake cycle and a melatonin deficiency can contribute to DSPS. Talk to your doctor and see if that might be a factor for you.

I have a 25-26 hour natural rhythm which does not follow the daily 24-hour cycle and which makes the corporate standard 9-6 hours difficult. The only time I've really synced up with the sun has been when I am doing long-term backpacking trips and getting massive amounts of sunlight. In an artificially lit indoor world I just don't match that cycle. I have however been in my current employment on the 9-6 schedule for two years now, which feels like a milestone to me. I should note that while I have maintained that schedule, I do feel that my most creative output has been diminished in the process. At the current time I've decided to accept that limitation while I save money to bootstrap a startup. I'm not convinced that a standard corporate job is impossible for someone in our situation, but it is definitely difficult and there is significant effort required. Self-discipline is critical if that is your goal. However, self-discipline is not sufficient if there is an exacerbating medical condition besides DSPS. I will freely admit that I have not fully conformed to my ideal 11-7 sleeping schedule 7 days a week, but even my somewhat sloppy adherence to sleep hygiene guidelines has made a large difference in my life.

One important consideration when looking for a new job is what sorts of scheduling responsibilities you will have. I for instance am miserable when I am on active on call duty 24/7. Contracting or consulting work with delivery-based responsibilities may be an option for you. I have not tried it yet.

Man I feel weird writing this next bit because I haven't yet fully overcome similar struggles in my own life. But here goes. You made a good call to stay with family while you've been dealing with the fallout of all this. Familial support can make a huge difference. It sounds like you are suffering from depression or anxiety - it would probably be productive to talk to guidance counselor, therapist, or psychiatrist to see if there is some coping strategy to use in the short to medium term while you get back on your feet. This would be in addition to developing habits and strategies to deal with sleep disorders. Going back into academics might be a good idea, but if you don't learn to manage your DSPS you will continue to struggle there. It might only prolong your anxiety about your job prospects. You need to decide what is most important to you. Is it finding a way to maintain a standard schedule? Is it finding a job where your employer is not concerned about a nonstandard one? Is it going into consulting or contracting where pay is based on delivery rather than physical presence? These are all valid choices.

I worked for a few months in a megacorporation. This was before I had found out about the root causes of my sleeping difficulties. After my struggles with sleeping disorders manifested as inability to maintain the mandated schedule I was asked to leave. It was devastating to me. I was told that the quality of my work was high, but that the need for a consistent schedule was more important. That was the tipping point which convinced me to aggressively pursue a method of attaining consistent sleep. As I mentioned, I've been in my current job with the same schedule (and a longer commute!) for two years now, so I feel that I've been mostly successful in that respect. For me, the next step is to strike out on my own and go into business for myself. Your choices are your own in that respect.

I wish you the best of luck. Know that your challenges are not insurmountable. From your description of your accomplishments it sounds like you are capable of doing great things, once you find a good environment and lifestyle. Don't let your prior bad experiences keep you down permanently. Whatever you decide to do, it will require discipline, calculated risks, and a willingness to go outside the ordinary. That can be scary, but may just be worth it.

[Edit: I think I may have just convinced myself to make some changes in my life as I wrote this response....]