He has a condition where he needs to masturbate or he will become very hyperactive.
I don't know of any medical conditions which cause someone to "need" to masturbate. However, it's a perfectly normal and healthy way of satisfying sexual urges and enjoying yourself, and it can certainly cause stress if you try and force yourself not to do it. You don't need a medical "excuse".
Similarly, feeling sexual attraction and wanting to engage in sexual activity with other people you care about and are attracted to are pretty normal and natural impulses too , whether you want to act on them or not (which isn't to say that acting on all your impulses is always a good idea).
It concerns me that you seem to be treating sexual desire as some evil alien force that made you have a "breakdown" or made your boyfriend "almost lose control" and be "very out of character". Thinking that way may actually make it harder for you to make cool-headed choices about whether you do or don't want to have sex right now.
Your sexual desires are part of you, and that's okay, whether you choose to act on them or not. They cannot take you over and make you incapable of controlling yourself or not responsible for your actions.
If you are truly determined not to have sex before marriage, for whatever reason, then it sounds like you need to avoid situations which are causing temptation for you, as "playing around" evidently is.
I'm not sure what you mean by "playing around" or "fooling around", but if you mean things like manual sex or dry humping, be aware that those are forms of sexual activity too.
Again, nothing wrong with that, but it's important to be honest with yourself about what you're doing. If what you've decided is that you want to reserve intercourse for marriage but engage in other sexual activities before then, then be clear about that.
Since it sounds like you're conflicted about this, it might also be worth thinking over (and discussing with your boyfriend) what your reasons are for wanting to postpone sex (or intercourse) until marriage. Knowing your reasons can help you feel more certain about whatever decision you make.