I usually get bored when I build something that gets me a ton of resources passively and I don't know what to do with it all. Like in my last survival world, I built a self-sustaining atomic science fusion reactor that powered 8 laser drills and 8 mass fabs which got me tons of stuff without me actually doing anything.
When I get bored, I take a break and come back later. Sometimes this means playing on a server or starting a new world, sometimes this just means going and doing something different for a change. Usually doing something different means going on some sort of adventure in the overworld, TF, pocket dimension, or a mystcraft age. I don't usually quit my world unless some new mod comes out that I really want to play with.