Ashby is bordered by New Ipswich, New Hampshire and Mason, New Hampshire to the north, Townsend to the east, Lunenburg to the southeast, Fitchburg to the south, and Ashburnham to the west. Situated at the northwestern corner of Middlesex County, Ashby is the only town in Middlesex County that does not border more than one other town in the same county.
Ashby is bordered by New Ipswich New Hampshire and Mason, New Hampshire to the north, Townsend to the east, Lunenburg to the southeast, Fitchburg to the south, and Ashburnham to the west. Situated at the northwestern corner of Middlesex County, Ashby is the only town in Middlesex County that does not border more than one other town in the same county.