After graduating in medicine at the University of London in 1859, he began to practise in his native town, but in 1867 he returned to London as teacher of practical physiology at University College London, where two years afterwards he became professor. In 1870 he was appointed by Trinity College, Cambridge, to its praelectorship in physiology, and thirteen years later he became the first occupant of the newly-created chair of physiology in the university, holding it till 1903. One of his most famous students at Cambridge was Charles Scott Sherrington who went on to win the Nobel Prize in 1932.
He excelled as a teacher and administrator, and had a very large share in the organization and development of the Cambridge biological school. From 1881 to 1903 he was one of the secretaries of the Royal Society, and in that capacity exercised a wide influence on the study of biology in Britain. In 1899 he was created K.C.B., and served as president of the British Association at its meeting at Dover.
In the following year he was elected to represent the University of London in parliament. Though returned as a Unionist, his political action was not to be dictated by party considerations, and he gravitated towards Liberalism; but he played no prominent part in parliament and at the election of 1906 was defeated.
His chief writings were a Textbook of Physiology (1876), which became a standard work, and Lectures on the History of Physiology in the 16th, 17th and 18th Centuries (1901), which consisted of lectures delivered at the Cooper Medical College, San Francisco, in 1900. He died suddenly in London.