Any advice?

So I had this boyfriend for a while and he ended things because we’d talk about the relationship lasting for a long time and it “deflated the relationship for him”, a few months later he’d gotten with a new girl and I was broken but recently I’d started to feel better again and then we started speaking and his relationship with his new girlfriend ended and he easily convinced me to spend the summer basically fooling around with him and he even stated that he couldn’t promise a relationship in the end and most likely just a friends with benefits situation and I fell for it. Luckily he told me he didn’t think this was right for us and didn’t want to lead me on anymore but I feel so stupid and broken for following my heart instead of my head, over and over again.