Initiate a closure. Whether it is a letter, a conversation or a ritual, make sure that it is final, leaving no room for ambivalence.
Move on quickly. Mourning has its place but should have a definite time limit.
Find alternatives. When a past relationship comes to mind, change the channel in your head. Do something, anything, to take your mind off the past.
Stop talking about it. The more you rehash the past, ask for advice or whine, the firmer the grip it retains in the present.
Get involved. Helping others and focusing on other people gives you freedom from your own problems and from self obsession that keeps you stuck in the past.