Sleeping with an ex

Lia
My boyfriend of a year and half broke up with me two days ago. His reason was he was not ready for that kind of commitment as though being together a year and about a half didn't already entail a lot of commitment. He also said that he might ask me our again in the future. We then both agreed we'd be friends but continue sleeping together. I agreed because I'm still in love with him and will do whatever to keep him in my life. Plus I just really liked the sex. I know what I'm doing is wrong and slightly unhealthy. Thoughts?