Boys at your age, are normally confused about gender, as well as
sexuality issues. It is a normal growing phase which all of us
encountered at this age.
But, you made matters worse by having sex with your friend.
Your friend might be as confused as you are, thus avoiding you coz
he knows that it is immorally wrong to have sex with the same
gender.
I would suggest that you to cool down first, avoid any contact with
your friend, and try to think it calmly if you are really gay, or
its just an illusion.
You can seek professional advice to further confirm your sexual
preferences.
Cheers.