Hi, I'd like to help you with your question.
It sounds like your boyfriend has commitment issues. Anytime someone shows a pattern of coming and going in relationships it shows that they cannot commit and are probably driven by fear of commitment.
You mentioned that he feels insecure about himself and thinks that you might not want to stay with him if he commits to you and your relationship. That may be true, but he seems to have felt that way about his previous relationship as well since he was off and on with her too. Either way, it is not a good sign for his ability to stay in a relationship.
He may also be fearful of the responsibility. People who fear commitment often really fear the responsibility in a relationship. They don't want to feel obligated to show how they feel and they may not like to feel vulnerable. They also may not like someone else wanting to know where they are or be involved in any way with their decisions. They would rather be on their own and have control rather than share it with someone else.
Your boyfriend needs to realize he has a problem in order for him to get help and deal with this issue. Therapy is the best option but if he won't go, he could work on this with you. Talking about why he is afraid to commit and taking small steps towards committing would help him overcome how he feels. Self help is also an option. The more he understands his fear of commitment the better off he will be to address it. Here are some resources to help you both work on this issue:
Getting to Commitment: Overcoming the 8 Greatest Obstacles to Lasting Connection (And Finding the Courage to Love) by ***** ***** and Julia Sokol
When the Man in Your Life Can't Commit: Recognizing the Signs of a Commitment-Phobe and What You Can Do About It by David Hawkins
Stop Running from Love: 3 Steps to Overcoming Emotional Distancing & Fear of Intimacy by Dusty Miller
You can find these books on Amazon.com or your local library may have them for you.
I hope this has helped you,