Sir Colin St John Wilson, who has died aged 85, will be remembered as the architect of the British Library, the most important public building in this country in the last quarter of the 20th century, begun in 1962 and finally completed, after budget and design problems, in 1997. More recently, he designed the new Pallant House gallery in Chichester, which opened last June, and to which he donated his outstanding collection of modern art.

He was professor of architecture at Cambridge University from 1975 to 1989. But he was also a teacher and writer who sought to explain the achievements and continued relevance of architectural modernism when it was least fashionable to do so.

Wilson was born in Cheltenham, the younger son of Henry Wilson, rector and rural dean there, and from 1929 Bishop of Chelmsford (known as "the red bishop" for his support of the republican cause in the Spanish civil war). Colin - or Sandy, as he was invariably called - was educated at Felsted school, Essex, where he distinguished himself on the cricket field. In 1940, he went up to Corpus Christi College, Cambridge, to read history, but changed swiftly to architecture, which he continued under Sir Albert Richardson at the Bartlett School, London, after war service in the navy. Years later, the Liverpool Post and Echo greeted his appointment as architect for the new civic centre with the headline "Navy man makes good."

For five years from 1950, Wilson was part of a talented group of architects, including William Howell and Alan Colquhoun, working on housing at the London county council under Leslie Martin (obituary, August 2 2000): they developed an 11ft wide prototype maisonette which was later incorporated into the widely admired blocks at Roehampton West. During this period, Wilson also began collecting the work of his artist friends, such as Ron Kitaj and Eduardo Paolozzi (obituary, April 23 2005), and took part in the Sunday morning meetings of the Independent Group with the architects Robert Maxwell, Colquhoun, James Stirling, Peter Carter and others, at the house of his neighbour Reyner Banham.

Wilson returned to Cambridge soon after Martin was appointed professor, as associate in Martin's practice, which was principally engaged in university buildings. Together, they worked on the new campus at Leicester, plans for the Royal Holloway College and, on the building type to which he was to devote much of his professional life, the Manor Road libraries at Oxford. In Cambridge itself, he extended the school of architecture with a brick cube that reflected the influence of the later Le Corbusier, and which Banham was to illustrate in The New Brutalism (1955). But both Harvey Court at Gonville and Caius College, designed with Patrick Hodgkinson, and the William Stone Building, a slender graduate tower for Peterhouse, are more indebted to the Finnish architect Alvar Aalto, who was to become Wilson's mentor in many respects.

In 1965, Wilson was interviewed and appointed as architect for the Liverpool civic and social centre. His office was in Cambridge, in a house and studio which he had designed as one of a pair in Grantchester Road; its entrance court boasted a Paolozzi sculpture and the fair-faced concrete block walls were hung with paintings by Kitaj and Blake. Undergraduates had been recruited at short notice to sit at the empty drawing boards, tracing already constructed and abortive work, in order to impress upon the visiting councillors how busy the practice was.

This enormous project went through several versions: the schemes were widely published, and influenced the design of other civic centres; they contained an early example of the glazed atrium, used not only as a main entrance and orientation device but as the principal expression of civic pride. Eventually, it was abandoned - only a footbridge survives, next to Harvey Lonsdale Elmes' great St George's Hall. Fortunately, the trustees of the British Museum had been considering a new building for its library, and in 1962 commissioned a feasibility study from Martin in association with Wilson.

Wilson became solely responsible in 1970, when the decision was taken to locate the National Reference Library of Science and Invention on the same site, because the trustees feared that Martin might not live to see its completion. This project was eventually to be built, albeit on a different site and only in part, and to occupy Wilson and his office from 1970 until 1999.

The site initially chosen for the British Library lay immediately to the south of the British Museum in Bloomsbury. Wilson's 1973 proposal divided it into two: a huge, top-lit humanities reading room served by underground bookstacks, and the science reference library, a linear open-access library. Housing was also required by the London borough of Camden, and this Wilson designed to frame Hawksmoor's St George's church.

But the idea of locating another large institution in the heart of Bloomsbury was strenuously resisted, and in 1974 the site was moved to an area with sufficient space to allow for a phased development that could cater for future needs - the railway yards next to St Pancras station on the Euston Road. Wilson has described the lengthy task of realising his magnum opus in The Design and Construction of the British Library (1998), revealing some of the traumatic process.

A vociferous group of scholars fought bitterly to retain their privileged access to Smirke's round reading room; Camden set extraordinary restrictions on the building as it approached Euston Road; the popular press delighted in every report of alleged technological deficiency; the Prince of Wales, who had laid the foundation stone, condemned its naked concrete frame - without apparently taking the trouble to consult the drawings and models to see its intended final appearance. This is to say nothing about the difficulties of meeting the needs of a multi-headed client.

In 1985, Wilson reviewed David Brownlee's study of George Edmund Street's law courts in the Strand: Street's death, at the age of 57, was widely believed to have been caused by the stress of being hounded by a vindictive civil servant. Wilson's wry sympathy was a reflection of his own experience - the difference being that he was determined not to allow it to kill him.

The British Library at Euston exhibits its long gestation period. Wilson never let the opportunity go to refine and elaborate the detail of the initial concept, which was evident from the start. As at Bloomsbury, the library is divided into two, but it takes advantage of its wedge-shaped site to create, in the constructed first phase, three top-lit reading rooms for the humanities, separated by the entrance hall, catalogue and restaurant areas from the linear science reading rooms along Midland Road. In the centre is the King's Library, apparently rising from the storeys of below ground book storage.

The building took 35 years to realise, and was finished three years after the Très Grand Bibliothèque in Paris, commissioned only nine years before. The latter is a modish and dramatic structure, but ultimately perverse, in placing the book storage in four glass towers. The British Library is the reverse - nobody could accuse it of modishness, and its arrangement is eminently functional.

The exterior may indicate the difficulty architects faced of finding an authentic institutional expression in the late 20th century: it is a deliberately anti-monumental monument. But the interior is a different matter: it pays deference to the dignified civic buildings of Gunnar Asplund and Aalto, and, in its craftsmanship and materials, reminds us of even older traditions: the interior spaces achieve a quality of proportion and detail that is exceedingly rare in our times. Sculpture by Paolozzi in the forecourt and the great tapestry by Kitaj in the entrance hall are given their proper place. Most important of all, readers have been generous in their praise. To achieve similar standards in its future expansion, and its inevitable alteration over time, will be a daunting task.

In 1975, following the untimely death in a car crash of William Howell, Martin's successor as professor of architecture at Cambridge, Wilson was appointed to the chair. He sought to expand the architectural debate, building on Martin's scientific research, but also introducing a critical and philosophical dimension.

His own Architectural Reflections (1992) arose out of his lectures to undergraduates, and The Other Tradition of Modern Architecture (1995) records his belief in the continuing relevance of architecture's humane mission, evident particularly in the work of Aalto and other Scandinavian architects. Wilson was a visiting teacher at a number of US universities, and, appropriately, was invited to be the keynote speaker at the first Alvar Aalto symposium in Jyvaskyla, Finland, in 1979. He was knighted in 1998.

He was also a practising artist and art collector throughout his life. The Pallant House collection has strong holdings of 20th-century figurative painting; sculptures, including Paolozzi; and an unrivalled collection of British Pop Art, which includes such icons as Peter Blake's The 1962 Beatles (1963-68).

Wilson's first marriage was dissolved, and in 1972 he married the architect Mary Jane Long. She became one of the partners in his practice, responsible with him for the library at Queen Mary College, London University, and a delightful house for Christopher Cornford in Cambridge, as well as undertaking many devoted years' work on the British Library. He is survived by her, and their son and daughter.

Jonathan Glancey writes: Sandy Wilson was that rare thing, a busy English architect capable of building even on a heroic scale, as with the British Library, who was also an intellectual. Not, though, so high-minded as to be incomprehensible in the way only intellectual architects can be, but a lucid thinker who enjoyed the knack of talking ideas, no matter how abstract, with an easy, fluent and confident grace. In the early 1950s, he contributed to the Observer; he was never an architect who looked down his nose at mere journalism.

He was especially good with young people. I treasure the wide-ranging conversations I had with him as a young assistant editor of the Architectural Review. He even made sense of Wittgenstein for me. Most recently, we had a lovely time pottering about the quietly refined extension to Pallant House.

Sandy always sought to craft his designs as thoroughly as the times, and budgets, allowed. I am still unsure of the way the British Library looks from the street - he was happy to argue about this with impressive detachment - but how, I wonder, will we see his kind of unmitigated quality in a future Britain in love with short terms and fast bucks?

· Colin Alexander 'Sandy' St John Wilson, architect, born March 14 1922; died May 14 2007