Gregory initially signed an 18-month deal after replacing Richie Barker at the club back in December but, having led Town to a 14th-placed finish in League One, the 59-year-old has been rewarded for securing the club's safety.
"I am delighted to sign this contract and commit myself to the club for the next two years and hopefully beyond that," he told the club's official website.
"It has been a tough first few months because of the backlog of fixtures we faced, but the main thing is that Crawley Town start next season afresh as a League One club still with the same ambitions to progress that brought me to the club back in December.
"There are going to be some new faces this summer and I hope our fans get behind them and show their support in the same way they have the players who have worked so hard for me since I came to the club."
Gregory's side rounded off their season with a 1-1 draw at home to Bristol City this afternoon.