Yeah, it's time to replace your chain, but this is the more relevant Sheldon Brown article to your issue:
Automatic Upshifting
Like Francis said, your derailleur adjustment is probably off, but lined up enough to stay put during casual riding, and then frame flex from getting out of the saddle and cranking is what allows things to get out of whack enough to autoshift. Does the chain rattle much when you ride?