I messed up

My roommate and my friend really like each other but can’t be together for another 2-3 years. Me, thinking that he can have sex as he pleases till then, has sex with him. After he finishes, he covers his face in shame. I ask what’s wrong and he claims to have made a promise to the girl that he would wait for her. I had no idea till after but he seems to be upset with me. I dont know how to talk to him but I just want him back as a friend. But at the same time I think I might like him. Advice?

UPDATE: thank you to all the positivity and to the not so positive comments. We finally talked about it and just accepted that we made a mistake. It was a one time thing and that it would never happen again