Tough situation to be in... On the one hand, you want you and your boyfriend to be monogamous to each other, but on the other hand, you find your friend attractive enough to be okay with your boyfriend telling you that he was excited by your friend, and also knew full well that something like this might happen in the future.
Being married gives me an interesting spin here, perhaps it will work for you--although Rob and I play around together when we meet someone to bring home, we seldom arrange something without the other knowing, and we usually both play, or are at least okay with the "guest". However, if we go out somewhere, such as one of the baths...we'll wander around on our own, within hollering distance for him (quite a distance, actually--good lungs), but still independent of each other enough to fool around...and this is with each other's full consent and mutual understanding.
Your boyfriend, obviously, felt that you had given him permission to "fool around" with your friend by being so unfazed by his comments about your friend's "being cute" and such...that when you awoke, they did the polite thing and removed their presence so as to not create any discomfort for you, regardless of whether you had any about "fooling around", because they didn't know how you might feel...
Regardless, you're shaken by this string of occurences. Have you talked to your boyfriend about it? If you do, since things were somewhat ambiguous, don't be accusatory, but--if this is what you want or prefer--ask him to be monogamous with you in the future if you are not able, or willing, or just don't want, to do a 3-way. If he can't or won't do that, then use protection, or invite him to leave if he won't.
Don't blame yourself, though, your boyfriend obviously has either no self-control or no willpower at this point in his life (I went through that stage, too)...although my willpower never left me, it was going the other direction--"Get more, and have more fun!"
Whatever happens, may it be for the best--you are young, still, smart enough and goodlooking enough that guys should be falling all over each other in their haste to get to you.