I don't know that there is really a trick to it, at least not in my case. As others mentioned above, it really just comes down to thinking before you speak, and with practice you get better at it. I had friend who used to write down all the things he didn't want to blurt out (in a journal or something) and he told me it helped get the secret (or whatever) out of his system and he didn't feel such a strong urge to talk about it...might be worth trying if you're having trouble.
Best of luck.
