Ayres was elected as a Democrat to the Sixty-fourth, Sixty-fifth, and Sixty-sixth Congresses. He was an unsuccessful candidate for reelection in 1920 to the Sixty-seventh Congress. He was elected to the Sixty-eighth and to the five succeeding Congresses and served until his resignation effective August 22, 1934, having been appointed a member of the Federal Trade Commission on June 30, 1934, in which capacity he served until his death in Washington, D.C., in 1952. He is buried in the Old Mission Cemetery in Wichita, Kansas.