Yup, you fucked up alright. You had one foot out the door and then decided to be a dumbass and spread your legs for some other guy. Did it never occur to you that you were proving all of your husbands jealous paranoid fears RIGHT by doing that? No wonder he has you over a fucking barrel now; you made him RIGHT! Now, he was right not to trust you. He was right (in his mind) to keep you on that short leash. WTF?!
But don't despair. All that rightness is in his tiny little head. It sounds to me like your husband made his own little self-fulfulling prophecy. He feared you'd stray from him, so he did all that shit to keep you, which of course only served to push you away from him into the arms of another man. Men do it all the time. They let their stupid little insignificant insecurities dominate their marriages and the wife ends up doing exactly what Mr. Insecurity was afraid of: Leaving.
However, dumbass that you were, you are still not some piece of property. There is no circumstance at all - EVER - that gives your husband (or anyone) the right to tell you who you can be friends with, what you can wear, etc. Yeah, you fucked up, but there is not fuck-up THAT bad. Tell you husband that unless he'd like to see you out that door for good, he'd better straighten his ass up - quick! He's doing the same shit that pushed you away in the first place and I don't predict that your marriage will last very much longer at all.
Don't think I'm blaming him for all this though. He started it, sure, but your response was fucking stupid. You made two mistakes right on top of each other. First, you cheated on him. Second, you told him about it. MORON! If you've managed to get away with cheating, DON'T TELL YOUR SPOUSE, STUPID! Oh, but you felt guilty. Waaaaah! Cry me a fucking river! Guilt is a useless emotion. There's no changing what's been done, there is only moving forward and the best way to move forward after this would've been for him to have never known what happened. Well, actually, the best way to move forward would've been for you to've STILL kept walking right out that damn door without ever telling him you cheated. You let him guilt you with that "Look baby, I'm changing" bullshit. Once again, your guilt led you straight down the toilet.
If you knew it was wrong, you shouldn't have done it. If you did it, then you should accept that it wasn't wrong. Either way, guilt should never come into play. People who feel guilt are pussies who're too damn wishy-washy to ever decide what they actually want. What you do is either right or it isn't, but the time to decide that is BEFORE you do it!
Now, kick your husband's stupid ass out the door. Tell him to take his drug-abusing, controlling, jealous, needy, whiny, bitchy, crybaby ass back to his mommy!