Remaining in the Republic of Texas, he was appointed a surveyor for the Texas-U.S. boundary commission led by Memucan Hunt.
Following the war, he served as chief surveyor of the US–Mexican commission which established the border after the Treaty of Guadalupe Hidalgo.
When the U. S. Commissioner, John Bartlett, a Yankee, gave away the Rio Grande's Mesilla Valley because of a map error, which had been disputed by the Mexican Delegation, the fiery Southerner Gray opposed the unacceptable compromise, and was removed from the commission (as surveyor, his signature was required for approval of the compromise).
He was replaced by friend William Emory, but not before Gray had finished surveying the original U.S.–Mexico boundary from the Rio Grande, over the Black Range, down the Gila River to its junction with the Colorado River, and across the desert of southern California to the Pacific Ocean at San Diego.
[6] He had settled in Tucson, Arizona, continued his surveying business, before joining the Confederate States Army on the outbreak of the American Civil War.