I can only second that. Or else get a gf. I personally think watching gay porn, googleing genital diseases or thinking of your grandma won't get you anywhere since you can simply chose not to. If it's porn that is leading to anything download the free version of this:
http://www1.k9webprotection.com/ and type in a password with your eyes closed. That way if the urge ever gets too strong, you won't be able to even if you wanted.
If it's just masturbating in general, doing lots of sports is the key. And I mean a lot. Give yourself no time to masturbate. Think about your mom or your sister or gay porn the instant you get an urge to. And don't eat foods that will boost your testosterone levels. Then cut down gradually until you stop completely to know that you're free of it.