John Murray, of St Benedict's secondary school, in Cheltenham sought the advice of the Wetherspoon pub chain, after the state of the lavatories emerged top of pupils' list of concerns.
Mr Murray said he had noticed the toilets were horrible and agreed that avoiding them all day could result in agony.
He said: "I like a pint, and recalled that if you go to a Wetherspoons on a Saturday night at 10pm the toilets are fine."
When he consulted Wetherspoons he was told to make sure the plumbing and fittings are of a high quality, that there should be money in the budget to replace things like locks and hinges which would undoubtedly break - and that the toilets should be cleaned every hour.
The pupils came up with the toilets' colour scheme, and since their construction in September last year all is still well.
Mr Murray said: "I had a visitor from the education authority today, and I took him to the boys' toilets at 3pm. I never would have dreamed of doing that before."
Tim Brighouse, the commissioner for London schools, said: "I know of one school who asked all the kids and all the staff what they wanted, and they re-did the lavatories. But they were a bit sneaky because they fitted smoke alarms in there that could only be heard in the staff room.
"There's all this thinking about teaching kids music and giving them water, but having given them water, they can't go to the lavatory."