Hi, I understand how you are feeling. This is because it sounds like that you crave the fun of it. This happens to some people and some act upon it. This is because sometimes we want what we can't have because it is fun and exciting. When we feel we have it then it is no longer a challenge and can be a bit "boring".
However, when we think we are losing the person or other people want them then we want them even more. You can feel this attraction and want without doing this unhealthy behavior. However, it will be a little different. Relationships take work and even though the " honeymoon" phase will not last forever the relationship can grow and bloom to a deeper meaningful relationship. This takes it to a whole new level and you can experience a wonderful closeness that is worth more than this back and forth you are in now.
The way to get passed this is to try and understand what is causing this as i have just mentioned, but the reasons behind this coukd be various and can stem from your past. You already have taken the first step and that is realizing and admitting this and this is a huge step to recovery from it in order to have healthy relationships. Counseling would be good along with self help. When you are aware of what you are doing take an active role to stop yourself and in time you can train yourself new healthy ways until they then come natural.
Please let me know if i can help further. I wish you the best.