In a lot of cases, I hear it's mental. When you're having sex, make sure you focus on the sensation. Don't even think about orgasm; don't try for it, and don't think about avoiding it. Keep the thought completely out of your mind. That, or pull out every 30 seconds and dip your knob in a bucket of ice water.