The trick that has always worked for me when I break up with a girl and have second thoughts about it is to remember and focus on the reasons why you broke up. Of course you're going to have times when your lonely and you might think you made a mistake, but if you remind yourself of all the fights, stress, and general bad-times, then you'll realize you did the right thing.
And when you do hook up with a new girl, don't let your loneliness get the best of you. Play it cool and don't get attached to another one too quickly. If you do that, you'll just be settling because you don't want to be alone.