how to gain trust back?

Woof. It sucks when you break trust because your pain (though real) is irrelevant in comparison to the person who you care about/hurt. It sucks to hear but is important to understand you caused this. You may need to look deep inside as to why you did this (if it is a mystery to you). Even so, look deep inside as to why you did this particular thing and you can gain insight on yourself. The insight you gain can be used for a genuine apology a perhaps this will be enough to mend the trust and continue dating. With that said, your BF isn't a confessional, so to speak. An apology should be short and concise. It may look something like, "I realize I am selfish and acted childishly, but don't want to be this way. I want to work on myself and be a better person with you in my life as my boyfriend. Please give me another chance." In my opinion, this is a better approach instead of reasoning behavior or expressing excuses for it. Good luck, I hope this helps.

Don't feel too bad after a couple of weeks from now (is my 2nd piece of advice) - this is good for your sanity. Accept the consequences with dignity.

/r/relationship_advice Thread