... when they sound they don't smell bad! (think about it)

 

(some may argue against this relation between sound and smell in the case of farts but I think that, at least statistically, it holds ... and, seriously, for the case of bad thoughts I am sure... but you have to do it quickly ... the more you try to hide them the more they will smell if you let them out at the end ... exactly as farts!)

An alternative formulation without the sound/smell property could be:

"Bad thoughts are like farts ... we all make them, but always (try to) hide them"

or maybe

"Bad thoughts are like farts ... you should never let them out in front of a woman" (this is a joke ... you should)

Or just

"Bad thoughts are like farts" :-) (this is not a joke!)