The level of homophobic bullying in Britain's secondary schools has fallen by a third in a decade, according to a study from the University of Cambridge.
The study, commissioned by the gay rights charity Stonewall, says the use of insulting language is less frequent and schools are more likely to prevent attacks on gay pupils.
But the report says 45% of gay pupils still face bullying.
Such behaviour needs to be "urgently addressed", says Stonewall's Ruth Hunt.
The study, carried out by the Centre for Family Research at the University of Cambridge, suggests gay, lesbian and transgender pupils in England, Wales and Scotland are less likely to face homophobic bullying than five or 10 years ago.
In 2012, 55% of gay pupils surveyed faced bullying because of their sexuality - and the report for 2017 suggests that has fallen to 45%.
The culture of school has begun to change, suggests the study, based on a sample of 3,700 11- to 19-year-olds.
"Since the 2007 School Report, the number of lesbian, gay and bi pupils bullied because of their sexual orientation has fallen by almost a third," says the research.
"The number of schools who say this bullying is wrong has nearly trebled, and homophobic remarks are far less likely to be heard."
More than a third of schools now have a dedicated club or society for gay pupils - and two in five pupils know of an openly gay teacher, the study suggests.
But there are wide regional variations in levels of tolerance.
While 36% of gay pupils report bullying in south-east England, it is a more common experience in Wales, where 54% of gay pupils face bullying, and the West and East Midlands, where 51% do so, according to the survey.
If there is a long-term trend away from gay pupils being bullied, the report says, it still remains unacceptably prevalent.
Bullying is experienced by 45% of gay pupils, most typically in the form of insults or gossip. But for 7% there were physical attacks and for 4% there were "death threats".
Mental health problems are described as "alarmingly high" among gay pupils, with four in five transgender youngsters surveyed reporting that they had self-harmed.
"While our new school report shows an improved experience for pupils in many ways, it also needs to act as a wake-up call for schools, government and politicians on just how far we still have to go," said Ruth Hunt, chief executive of Stonewall.
"Almost half of LGBT [lesbian, gay, bi-sexual, transgender] young people are still bullied at school for being LGBT," she said.