The 22-year-old spent six years at United, progressing through the ranks from the Academy to the Reserves, and joins Darren Ferguson's side on a two-year deal.
Speaking to the official PNE website, Gray said: "I have been on loan for the last two seasons and now I have got a permanent move which I think I will enjoy.
"Preston have always been a solid Championship side for as long as I can remember. There are great traditions and it is a big club."
Gray will see a familiar face at Deepdale - young United midfielder Matty James joined the Lilywhites on a season-long loan deal earlier this month.