Once you’re aware of the problem, you can deal with it most effectively.
Then you have to just stop doing it. This is a discipline. It’s very hard for a lot of people to stop doing something — like eating carbs or sitting around like a slug and start going to the gym — for you it’s not staring at other guys. Just look away. In fact, if you see a guy or a group of guys walking your way, look down. Watch your feet, check your watch, text a girlfriend — do anything but look [i]at the guy
For many people those two steps are enough:
1. Recognize the problem.
2. Employ discipline to stop doing what you don’t want to be doing.
For other people, knowing the cause behind the problem helps them to change their behavior. For instance, if the reason you’re looking at other guys is that you’re secretly (maybe even subconsciously) hoping to catch their eye and elicit an approving once over, a wolf whistle or some other form of sexual attention, then you need to ask yourself why you need this from someone other than your boyfriend.
If the answer is maybe you’re not getting enough attention from your boyfriend, he could step up and help with this problem by giving you more romantic and sexual attention. Love letters, flowers, chocolates, romantic dates — whatever works for you and he — could solve the problem. If you’re getting enough attention from him you may not need it elsewhere. Is he generous with his compliments and attentions?
If the answer is that you have a self esteem deficit that stems from your childhood, then you’re the one who has to do the work on yourself, start changing your life so that you accomplish more and recognize your accomplishments as those of a real winner. Then you have to understand that the winner is you! And that you don’t need to look to men you don’t know for “hits” of self esteem. You can get it from within.