10 years ago I was laid off. I had just turned 40, and was living in an area that didn't have the most robust job market (plus at the time the hiring outlook was terrible in general due to the financial crisis).
After looking locally to no avail... I added a new strategy: apply to various federal government jobs. Benefits include stability (although with the recent furlough maybe that isn't 100% rock solid) and no possibility of the job being outsourced/offshored, etc.
I'm 50 now, been a software developer for 25 years, still working for the government, and still enjoying it. Projects are varied, I have reasonable latitude in the programming I do (job is ~50% coding, ~50% other stuff), managers understand work/life balance. Yes I don't get stock options out the wazoo and other Silicon Valley style perks but I also have other hobbies and time to enjoy them. There are tradeoffs but overall I'm glad I did it.