A years long D&D campaign is sort of like a marathon in the snow, but up hill both ways.
Well. I have honestly been in far more 3-5 shot campaigns than not. In fact I believe there is a "law of RPGs" that is something along the lines of never plan for more than 12 sessions. In the span of 12 sessions there is always some sort of life changing event that occurs if you have say a five player group and a DM. Someone's girlfriend/boyfriend has a work schedule change, one of the players or the DM has a work schedule change, a new semester starts with different class schedules, etc. You get the point. It seems that over the 20 or so active years I've had as a gamer that every RPG campaign I've been involved in seems to have had a maximum realistic trajectory of 12 sessions. So as a DM I plan for only 12 sessions to start and then go from there.
So to answer the initial question. The longest game I every played in was actually the very first a red box basic game. It lasted about two years technically. We played in the same home brew campaign setting. The second longest was about 20 months I think, 2nd ed. D&D. The longest game I've ever run is actually the one I just wrapped up, which was a mere 30 sessions (ish), Dungeon World. We might pick up again in the game perhaps next fall. The players have interest. The reason the campaign ended was me. I have some big stuff coming with school and work so I thought it best to have a nice "chapter 2" end point and allow someone else in our group to run a game for awhile.
I have some ambition to possibly run an Iron Kingdoms game over the summer and some one shot fun stuff here and there. If I fire up a long term DW game again it will probably be next October and then I'd run it through the winter into the late spring probably.