Every guy over the age of 10 knows the feeling: you're hanging around innocently, when out of nowhere, BAM! Your junk is standing taller than the Eiffel Tower for no apparent reason. If you're tired of the not-so-effective waistband tuck, there are better solutions.
This is an old tip, but I'm always surprised at how many people don't know it: when you feel an unwanted erection coming on, just flex another muscle in the area, such as your thighs or buttocks. Flex those thighs like you're The Hulk trying to rip through your somehow-indestructible purple pants. Coupled with innocent thoughts of sport, your conspicuous boner should disappear pretty quickly.
I can't remember where I heard this first (it's been a few years), but a quick Google search reveals quite a few articles and forum posts that have discussed it. I couldn't tell you exactly why it works — the general theory is that it redirects bloodflow elsewhere — but it's always worked well for me.