how to cope with a breakup?

my first boyfriend who i care about and love more than anything just broke up with me. I feel like I can’t breathe I am so sad. it makes it worse because he broke up with me because I couldn’t give him enough space. he is depressed and I was trying to be understanding but he wouldn’t talk to me for like 5 days at a time and I would be worried sick. I feel bad because I didn’t think I was that annoying but I am. I am so sad because it feels like this is all my fault, that i could’ve avoided it if i just would’ve left him alone. he said it isn’t all my fault and he just needs time for himself but I still feel like the shittiest person alive, I never wanted to hurt him. we still talk and agreed to be best friends but i’m just so sad, he even told me he’s still in love with me but he just can’t do this right now, that he needs to love himself first. I don’t know what to do, I love him more than anything. how long does this hurt? he has me convinced that he will come back to me one day but i’m trying not to get my hopes up.