Like so many modern couples, Tom Wang and his wife met online. On their first date, in a teahouse, he admired her femininity. They married a year later and are now negotiating the decor of their new flat.

Wang hopes they will grow old together, yet refused to pay for her wedding ring and is wary of having a child. "I have a headache when I talk about that," said the 40-year-old software engineer, with a half-smile, half-grimace.

His wife is not family; not even a friend, he said – merely a partner in their joint endeavour. He is gay, she lesbian. The marriage is a facade, erected to satisfy their parents and protect their careers.

Though homosexuality was illegal in China until 1997, and remains a sensitive issue, the country does not have the deep-rooted, vicious homophobia of many other places. For most of its history, it "not only tolerated male same-sex love but also celebrated it", writes Richard Burger in Behind the Red Door, a history of sex in China.

But such relationships supplemented marriage rather than replaced it. According to the tenets of traditional society, the worst kind of unfilial behaviour is failing to continue the family line. Even now, the pressure to marry and have children is intense. Zhang Beichuan, an expert on homosexuality at Qingdao University, believes about 80% of gay men and lesbians marry. Most wed straight partners unaware of their spouses' sexuality. Others, such as Wang, find a homosexual partner of the opposite sex by asking friends or advertising online.

One woman in her early 20s writes on one such website: "I have promised my parents I will marry by 2014 … I am looking for someone who is simple, honest, has an apartment, does not want a child.

"We won't disturb each other. The marriage will last at least five years."

Another says she and her girlfriend are out to please their parents, but want a baby. As an openly lesbian couple they would face social stigma; birth control policies also make life harder for children born to single mothers.

"I want to find someone who is healthy, not bad looking, intelligent, kind and cheerful," she states.

"You don't need to raise the kid, but I hope you are a father who will love the kid and be a male role model."

Wang (not his real name) spent five years seeking a suitable bride. For men, the pressure to marry starts in their early 30s, he said; for women, much earlier. His wife, almost a decade younger than him, also wanted to allay her parents' suspicion after they reacted angrily to her attempts to come out.

Wang bought time by telling his family that Shanghai girls would not look at him until he had a flat. His sister asked outright if he had physical problems.

"My parents are from the countryside. Everyone compares themselves with each other, especially about their children," he said. "It was a big deal that I went to university in the city and got a good job – so why couldn't such a great guy find a wife and have children? That was a lot of pressure for my parents."

Even in the city, being openly gay could really harm you at work, he says. Simply being single is a problem: "I work for a foreign company so it's not so bad, because they respect personal privacy, but they still want you to take your girlfriend or wife to company events. If you are single, people think you're weird. They feel you are more responsible and mature after you marry. They also feel you have a family to feed so maybe they should give you a chance," said Wang.

Thanks to such pressures, as many as 12m gay men are married to straight women, estimates Xing Fei, of the Sichuan Academy of Social Sciences.

Wang said he never considered that option: "I know if a woman loved me, I couldn't give her the love she would expect or want. For a woman, that's tragic," he said.

Xing said others wanted to avoid a straight partner's sexual demands.

But marriages of convenience bring their own difficulties. "Some of these marriages are good – they can help and support each other – but most don't last long," warned Zhang.

Couples may agree in advance to an early divorce. Others find cohabiting and sharing family duties harder than expected. Splitting up can bring disputes over children and property.

In Wang's case, their property is registered in their own names. They have also covered every detail they could think of – he will pay all travel costs for visiting his parents, for example – in written terms that are not legally binding but make their mutual expectations clear.

They will have separate rooms, but share a bed when his family comes to stay. They will not give a key to her parents, who live nearby, lest they pop in unexpectedly.

"I'm really lucky to find her, and she's a generous person," Wang said of his wife. "But there will be more problems later. With love you can put up with a lot. Without love, it's harder."

Additional research by Cecily Huang