The 20-year-old has become the Hatters' eighth summer signing, joining on free transfer but with a "contingency sum" due to Palace if he is sold on.
Gray made two first-team appearances for the Eagles and spent much of last term on loan at Hartlepool, scoring six goals in 33 games.
Hatters boss Nathan Jones said they had been chasing the signing "since April".
He continued: "There were a number of clubs that showed an interest in him. We initially thought we might get him on loan, but when we knew that Palace were willing to do something permanent, we jumped at the chance."
Find all the latest football transfers on our dedicated page.
League Two side Luton Town have signed Crystal Palace midfielder Jake Gray on a two-year contract.