Campbell was elected as an Opposition Party candidate to the Thirty-fourth Congress. He was an unsuccessful candidate for reelection in 1856 to the Thirty-fifth Congress. He was again elected as a Republican to the Thirty-sixth and Thirty-seventh Congresses. He was not a candidate for renomination in 1862.
During the American Civil War, Campbell served as major of the Twenty-fifth Regiment of Pennsylvania Infantry. He was appointed Minister to Sweden by President Abraham Lincoln in May 1864 and served until March 29, 1867. He declined the diplomatic mission to Colombia in 1867. He located in Philadelphia in 1867 and continued the practice of law. He died on his estate "Aeola," near Wayne, Pennsylvania, in 1895. He was interred in Woodlands Cemetery in Philadelphia.