Sanford is a town located in York County, in the state of Maine, United States. It is situated in the southern part of the state and is approximately 40 miles southwest of Portland, Maine's largest city. Sanford had a population of 21,982 residents in 2020.