Getting over him

i’ve liked him for 3 years. we’ve basically been unofficially together for the whole time. a few months ago,something happened and things got complicated. since then he’s been lying to me. he said he would try harder and he wants a committed relationship, going as far as saying he loves me, then in a week he’ll say he wants for work on being friends. this cycle has happened multiple times, and i feel so shitty with myself for believing him every single time he said he was going to put effort into “us”. a few days ago we ended it, but he’s been my best friend for 3 years. i don’t know how to cope with this. losing my best friend and the person i loved the most. i still love him, which is the hardest part.