In 1859 Gray was elected a foreign member of the Royal Swedish Academy of Sciences. The National Academy of Sciences was created by Congress on March 3, 1863, and he was one of the original 50 members. In 1864 Gray donated 200,000 plant specimens and 2,200 books to Harvard with the condition that the herbarium and garden be built. This effectively created the botany department at Harvard, and the Gray Herbarium was named after him. He was president of the American Association for the Advancement of Science in 1872 and of the American Academy of Arts and Sciences 1863–1873. Gray was also a regent at the Smithsonian Institution in 1874–1888 and a foreign member of the Royal Society of London in 1873.