Gray, 36, spent the past three seasons with the Yellows, where he played alongside current Purps boss Craig Robinson.
Robinson said: “It's a pleasure to welcome Tony to our football club and for us to attract a player like him to the club shows how far we have come, especially when you look at the clubs Tony has played for throughout his successful football career.
“He comes with a good goalscoring record, including last season, and will bring plenty of experience to the squad."
Gray has twice commanded a fee when moving clubs during a career that has taken in spells at the highest level of non-league football with Chester, Southport and Telford, as well as a spell in Wales with Airbus and Bangor City, where he played in European competitions.
He said: “I'm happy to be signing for the club and am looking forward to getting together with the lads and getting down to hard work."
Keep up-to-date with our exclusive email newsletters.
Subscribe