John Perdue Gray was born at Half Moon, in Centre County, Pennsylvania on August 6, 1825 the son of a Methodist minister. He was schooled at the Bellefonte Academy and entered Dickinson College in 1842. While at the College he was a member of the Union Philosophical Society. Upon graduation with the Class of 1846 he studied medicine at the University of Pennsylvania and by 1848 had earned his M.D.
After serving his residency at Philadelphia's Blockley Hospital, in 1850 Gray took the position of assistant superintendent at the Utica State Lunatic Asylum in New York State and in 1853 became acting superintendent. After serving as head of the new Michigan state asylum at Kalamazoo for a short time, he returned to Utica as the permanent director of the institution in 1854 at the age of twenty-nine and remained in that post until his death. In a matter of years he built a reputation for innovation and reform, introducing systematic recording of case notes and postmortem examinations as a routine. Gray began to deviate from the notion that mental illness was a result of moral and physical weakness, and instead tended towards an explanation which stressed the effects of inheritance and environment. At Utica fresh air and exercise replaced restraint and forced feeding. He also became an avid promoter of the extension of mental health treatment to the poor, although in 1858 he took over the private treatment of the millionaire reformer and abolitionist Garrit Smith, who had suffered a nervous breakdown after being falsely implicated in preparations for John Brown's raid on Harper's Ferry. By the time of the Civil War, Gray was one of the best known psychiatrists in the country, as well as editor of the American Journal of Insanity and a government advisor to President Lincoln. Along with his continued work at Utica, he was appointed professor of psychological medicine and jurisprudence at Bellevue Medical College in 1874, and at Albany Medical College two years later.
Disliked by some for his autocratic use of his powerful connections, Gray was a well known and highly successful expert witness in trials concerning insanity. In 1865 he had examined one of the men implicated in Lincoln's assassination. Weighing 300 pounds, he possessed a commanding physical presence on the stand; his expertise added to his overall stature. Gray's most notable court appearance was as a witness for the prosecution at the trial of Charles Guiteau for the murder of President James Garfield, in which the accused entered one of the first ever innocent "by reason of insanity" pleas in United States legal history. Such was Gray's reputation that both sides agreed to abide by his judgment after examination as to whether or not Guiteau was fit for trial. During the trial, from November 1881 to March 1882, Gray steadfastly argued that Guiteau was sane at the time of the assassination. He backed his assertion with clear testimony bolstered with an impressive array of notes taken in interviews with the accused. Few ever believed that Guiteau would escape conviction, and ironically his post mortem examination showed that indeed he was suffering from a form of syphilis of the brain.
Ironically, John Gray was shot and wounded in the face by one of his own patients, Henry Remshaw, on March 16, 1882 soon after the close of the trial. He spent an extended period of convalescence away from New York but never completely recovered; he died on November 29, 1886, soon after resuming his work at the asylum. He was survived by his wife Mary B. Wetmore Gray of Utica who he had married in September 1854.