The 20-year-old broke into the senior squad last season, making four appearances in the process.
Having sorted out his future, the defender admitted that he was "delighted".
"I'm delighted to get it done. It's taken a bit of time to get it sorted but I am happy now," he told the club's official website.
"I have been here for a while now and loved every minute of it. Now this is sorted I can focus on working hard and continuing to improve."
Duffy has had loan spells with Burnley and Scunthorpe United.