Gallagher graduated from Georgetown University in 1994 with a BA in English and earned a law degree, magna cum laude, from the Columbus School of Law at the Catholic University of America in 1998. He began as an associate in the securities department of WilmerHale, then became senior vice president and general counsel of Fiserv Securities.
In 2006 Gallagher joined the SEC as counsel to Commissioner Paul S. Atkins and later to Chairman Christopher Cox. He became deputy director of the Division of Trading and Markets in 2008 and was its co-acting director from April 2009 to January 2010, then returned to WilmerHale as a partner. He served as an SEC commissioner from November 2011 to October 2015, pushing for broad reviews of equity and fixed-income market structure and criticizing the Dodd-Frank law's rule mandates. He voted no on 16 rulemakings.
After the SEC, Gallagher became president of the consulting firm Patomak Global Partners in 2016 and chief legal officer of the drugmaker Mylan in 2017. He rejoined WilmerHale in September 2019 as a partner and deputy chair of its securities department. Robinhood, where he had been a director, announced in May 2020 that he would join as chief legal officer. In November 2024 he was reported to be the frontrunner for SEC chairman in the Trump administration, but withdrew from consideration.