Rae became Headmaster of Westminster School in 1970. During his time there he became a prominent and oft-heard voice on educational questions in the British print and broadcast media, known as a singular and distinctive figure by the precedents of public school education of the time. He modernised the school and rescued it from its perilous financial position. To do this, he cut staffing and moved the science department from its cramped building to a modern building within easy reach of the school. It was under his Headmastership that girls first became full-time members of the school, in 1973. In 1976 a new day house, Dryden's, was created. It is located next to Wren's and under College, just off Little Dean's Yard. In 1981 to cope with the increased numbers of girls a new boarding house, Purcell's, was opened. It is still located about 200m from Little Dean's Yard. In the same year a new building was bought for the Under School - Adrian House in Vincent Square.
In the end, he was more or less forced to resign, because of the furore over A World Apart, a book written by his wife Daphne Rae, which detailed their joint experiences during their time at Taunton and Harrow.
His ashes lie off the cloisters of Westminster Abbey, near a door from Little Dean's Yard used by Westminster boys when they go "Up Abbey". There is often a vase of fresh flowers at the commemorative stone.
Rae was a prolific writer on education, his works including Letters to Parents, The Public School Revolution, and a professional autobiography, Delusions of Grandeur. His 1961 novel, The Custard Boys, shortlisted for the John Llewellyn Rees Memorial Prize, was adapted to make the 1962 film Reach for Glory, which won a United Nations Award, and again for the 1979 film under the novel's original name. In 1983, he assisted Roland Joffe in the production of the film The Killing Fields, and in 1986 he became head of the Laura Ashley Foundation. He was on the board of The Observer newspaper from 1986 to 1993, and in 1989 became executive chairman of the Portman Group, which advocates responsible drinking.
His edited diaries were published in 2009 as The Old Boys' Network: A Headmaster's Diaries 1979-1986 (ISBN 978-1-906021-63-4).