I grew up thinking you should try to stay with a company, but the greed of the 80's killed that notion. Heck, at one point I worked for four different companies, while keeping the same office!
Unfortunately, loyalty is rarely compensated. At one place I stayed for 8.5 years, had the NICE corner office looking down at the beach from one window and $10 million houses out the other (Fashion Island area of Newport Beach California). I could see the 5th hole fairway from my window and watched Tiger Woods playing his last amateur tournament. I had my own fridge, two workstations, a high-back leather chair and a nice job title with my own, reserved spot in the parking garage. All of it in lieu of pay. Back then, if you worked 2-3 years and left, you typically got a 20% pay increase. Stay and you were lucky to get 2%. When I started having to hire people for positions below me and offer them quite a bit more than I was making, I left to become a contract consultant again which TRIPLED my income.
All in all, over a 24-year span, I only worked for four companies. If you count working for myself as one, it's only been six companies over the last 38 years.