8 jobs in 22 years. 2 of those moves were voluntary. 4 were layoffs, 1 was a short-term contract. I stayed in my first job the longest (not quite 8 years), and would have stayed there longer except the interesting work was drying up (defense and government sector) and I was being payed significantly below market. Loved the people, liked the environment, but at the time felt it was the best move for my career (and I wasn't wrong). Second longest was 5 years and some change (I just got my third week of vacation, but was never able to use it), also defense sector.
The shortest was 5 months before I got laid off. Won't say much about it, except that it taught me not to take the first offer that comes along unless I feel really comfortable about it.
The key to staying in one place is for the work to be interesting and engaging. Corporate IT pays the bills, but it doesn't exactly get the blood pumping, at least not for me (I know some people who live for that kind of work, and they're nuts). I've spent about 2/3 of my career working in defense (mostly simulators or combat awareness apps rather than weapons systems) because the projects were interesting, even if my particular role wasn't. They also afforded me opportunities to learn new skills and technology on a regular basis, which kept the job fresh and helped me stretch professionally.
It sounds to me like you're taking jobs solely based on what they pay, not because you find the work itself engaging. IMO, that's a mistake, and no doubt why you're feeling the way you do. Unfortunately, I don't have any real advice beyond "find work that you enjoy doing". That may require a pay cut, it may not. You can't work just for a paycheck, at least not in a field that requires non-trivial amounts of brain work.