Cogill arrives at Northolme having left National League North side Scarborough Athletic.
A versatile operator at the back, he will add further depth to a defensive line that has conceded just twice in their opening four league games.
The Holy Blues remain unbeaten ahead of the Bank Holiday weekend, having won one and drawn three matches so far in 2022/23.
Cogill graduated from the youth setup at Huddersfield Town before joining Scottish side Clyde following a successful loan spell.
After recovering from a knee operation, he then joined Farsley Celtic, prior to his move to Scarborough.
During his time on the Yorkshire coast, he made 24 starts as the Seadogs sealed promotion via the Northern Premier League play-offs.
On the signing, joint-manager Dave Parkinson said: "Dylan is a player I have worked with briefly at Frickley and we are really pleased to be able to get him in.
"He fits the type of player we are looking to bring in perfectly. Young, hungry but also brings lots of experience having won promotion with Scarborough last year.
"He is a player we wanted to try and bring in at the start of pre-season but have had to be patient. He will add some experience and also give us more options at the back."
Cogill added: "Gainsborough seems like a club I can really get on board with.
“I’ve heard nothing but positive things from people I’ve spoken to about the club, and I’m really looking forward to getting started.”
Photo credit: Scarborough Athletic
Keep up-to-date with our exclusive email newsletters.
Subscribe