Ashton, 34, has previously featured for Bolton Wanderers and Chorley and joins the club from Lancaster City.
He has made more than 400 appearances at senior level with seven different clubs and becomes Boro’s twelfth signing of the season.
Manager Lee Fowler said: "We have been looking for someone to fill the gap with Cam’s suspension for two games at the start of the season. Both myself and the staff have been on the phone for months and have been let down on numerous occasions by people and goalkeepers themselves.
"We had to let go of our goalkeeper coach for in-house reasons, so we found ourselves needing a goalkeeper coach, but to have a reliable keeper with experience at this level was key.
"Sam said he would like a dual role and that is exactly what we were looking for. Importantly, it will also push Cam to be at his best at all times so it was music to my ears as we killed two birds with one stone.
"He lives five minutes away from the ground so he will be no stranger to the club, or the town. I am really looking forward to working with him."
The club also added winger Adam Dawson and midfielder Nathan Valentine for the season.
Keep up-to-date with our exclusive email newsletters.
Subscribe