Shirley is a town in Middlesex County, Massachusetts, United States. It is approximately thirty miles west-northwest of Boston. The population was 7,211 at the 2010 census. The town has a well-preserved historic New England town center.
It is home to the Massachusetts Correctional Institution – Shirley, a medium-security state prison. (The neighboring maximum-security Souza-Baranowski Correctional Center lies just outside the town limits in the town of Lancaster.) The remains of a Shaker village have been preserved within the grounds of the prison.
The inhabitants at the time of European encounter were Nipmuc (or Pennacook) Indians, who called the area Catacunemaug. Once part of "The Plantation of Groton," Shirley was first settled by English pioneers about 1720.
In 1753 it separated from Groton and was incorporated, named in honor of William Shirley, governor of Massachusetts (1741–1757). The town established a paper mill around 1790, and the first of seven cotton mills in 1812.