If you are heterosexual and had a dream in which you were having sex with a person of the same sex, this may suggest that you are sexually attracted to members of your own sex but have repressed this inclination.
If this is the case, your dream may have been fulfilling your unconscious fantasies and was encouraging you to be honest with yourself. Many psychologists believe that we are all bisexual at a deep level; a dream like this may have given you the opportunity to explore in a safe environment an experience that your conscious mind finds objectionable due to social conditioning. If, however, you are convinced you are not gay or lesbian, your dream may simply have highlighted the intimate nature of your friendships with people of the same sex or your desire to meet someone similar to yourself. Your unconscious may also have been highlighting the fact that if you are in a relationship, you sometimes you feel closer to your friends than you do to your partner.
If you are homophobic in waking life or in your dream, your unconscious may have been urging you to be more open-minded.
If you are gay and dream of making love to a person of the same sex, this will have much the same interpretation as dreams concerning heterosexual sex and partnerships.
If you are gay and have dreams of heterosexual sex, your unconscious may be highlighting unconscious attractions or emphasizing the closeness of your emotional bonds with friends of the opposite sex.
[1]Any sexual act in a dream connects symbolically to the process of integration and the joining together of different aspects of the personality. In the case of gay sex, what is being highlighted is elements of the masculine principle such as taking action and aggression.
It is not unusual for heterosexual men and women to have dreams about gay sex, and such dreams are not necessarily related to sexuality or the waking-life expression of it. However, if the dreamer identifies as a gay man, then such dreams should be explored more literally.
[2]