Cobb was elected as a Republican to the Forty-first, Forty-second, and Forty-third Congresses (March 4, 1869 – March 3, 1875). He served as chairman of the Committee on the Freedman's Bureau (Forty-second and Forty-third Congresses). He was an unsuccessful candidate for reelection in 1874 to the Forty-fourth Congress. He resumed the practice of law in Elizabeth City, and died there on April 30, 1879. He was interred in Episcopal Cemetery.