If you are in a company like Cisco, make sure your mortgage is paid off before you turn 50, and make sure you have been maxing out your retirement account for at least 10 years (possibly more). If you are laid off near 50 as an engineer, you are never going to work at 6 figures as an engineer. This, I will guarantee. While you have that high income, save, buy a rental or two on the side, max your retirement, and spend conservatively.
If you are in Silicon Valley, forget about buying a house. Unless you have some hefty RSUs that can vest someday, it makes no sense to buy a house in SV.
For the young/mid career folks who are starting out: Know and understand that Cisco is ruthless, and unless you happen to have enormous domain knowledge of some critical software, you are expendable, and Cisco will expense you. Like clockwork, I have seen engineers in their 50s being bid adieu even in profitable BUs. After the shock the first year, I semi-accurately predicted who would be LR'd the next 3 years.
Finding the right company is a lot like finding a right partner. There are some companies where older engineers are respected. If there is still time for you, find a company like that, stick to it and take your chances. If you are at Cisco, make sure you are working on new technologies and have transferable skills. If you are stuck babying older products with horrible code bases, may God help you.