Being in the closet is often a function of the societal expectations for any gay man. Closeted gay men often work hard at their image in order for them to blend into the largely heterosexual community. Majority of them even marry or have sexual relations with female companions.
The clamor to look heterosexual for any closeted gay depends on the extent of tolerance in the community. In the event that the community is less tolerant towards gay behavior, the gay man will instinctively pretend to be heterosexual. If the community or family is more tolerant, closeted gay man will be less likely to hide behind heterosexuality.
Gay men also attempt to appear heterosexual since they may be fighting to accept that they are indeed gay. In this case, the gay men try to appeal heterosexual in hope that they will outgrow that phase of their lives. Closeted gays also indicate the desire to be accepted in the society hence bottling down their natural urges is the only reasonable way.
Finally, gay men pretend to be heterosexual just before mustering the courage to come out of the closet out of fear. This is mainly the case in the event that they lack the support system. Remaining closeted appears to be a more acceptable option than coming out and declaring their orientation. It may also be a way of warding off unwarranted attention.