After Mexico, Anderson was promoted to first lieutenant in the 2nd U.S. Dragoons on July 13, 1848, was again on recruiting duty in 1849. He returned to the Carlisle Barracks from 1849 to 1850, and then was recruiting once more until 1852. Next came frontier duty in several Texas installations, including at Fort Graham in 1852 to 1853, at Fort McKavett from 1853 to 1854, at San Antonio in 1854, and at Fort McKavett in 1855. He was promoted to captain on March 3, 1855, and was stationed at Fort Riley, Kansas, from 1855 to 1856. Anderson was still serving in Kansas during the border troubles of 1856 and 1857, then was recruiting as well as his last stint at the Carlisle Barracks in 1858. He participated in the Utah War of 1858 and 1859, and was on duty at Fort Kearny, Nebraska, from 1859 to 1861.