Gayles also had a successful political career after the war, initially as an appointed civil servant, and from 1872 until 1887 as an elected official. On September 17, 1869 he was appointed member of the Board of Police for District Number Three, Bolivar County by George A. Ames, and on August 2, 1870 he was appointed Justice of the Peace for the Fifth District, Bolivar Count by Governor
James L. Alcorn. On August 29, 1870, Gayles was appointed supervisor of the Fifth District, an appointment he held only until November. In 1880, Republicans were split between a number of candidates, and Mississippi republicans were split between
John Sherman and
Ulysses S. Grant. At the convention, Grant originally received the largest share of the vote,
James G. Blaine was the initial second largest vote getter and Sherman third, but none received a majority. Gayles was a member of the "three hundred and six" which supported Grant in all ballots, but Grant never got more than 308 votes and the eventual nominee and then president was
James A. Garfield. Gayles also served in the House as a representative of Bolivar County as late as 1894. In the House, he represented the 28th district, which included Bolivar, Coahoma, and
Quitman County. In the Senate, he represented the ninth district, including Bolivar, Coahoma, and Sunflower counties. He was also chairman of the Third district Republican Convention in 1886 in Mississippi consisting of Bolivar, Coahoma, Issaquena, Leflore, Sunflower, Sharkey, Tunica, Quitman, Washington, and Warren counties. He was the only black state senator in
Mississippi during his terms (It would not be until 1979 when two Black state senators were elected to represent Hinds County where Jackson is located) ==Later career==