Thread lock.
It comes in all sorts of varieties, from "holds like a weld for the rest of time", to "gently holds", and the way of removing it varies as well, from applying heat breaks it down, to a solution you drop into the threads that dissolves it, and of course the ordinary stuff that just needs a bit of muscle to break it.
Don't use stuff too strong unless you never want it to come to bits.
http://www.loctite.co.uk/threadlocking-4476.htm