Shirley is a town in Middlesex County, Massachusetts, United States. The population was 6,373 at the 2000 census. The town has a well preserved historic New England town center and is home to two state prisons, including the Souza-Baranowski Correctional Center. The remains of a Shaker village are located on the prison grounds.