This is an amazing tip that really works to get you started, if you are determined to learn how to guard your eyes:
Commit (for a few weeks or a period of time), to pinch yourself -- enough to make it hurt -- every time you gaze improperly at something that you know you shouldn't.