Hammill became a firm favourite at Oakwell after spending the final three months on loan last season and Tykes manager Simon Davey was keen to bring the 21-year-old back to South Yorkshire.
Davey told the club's official website: "Adam is a fantastic prospect and one we're delighted to bring to Oakwell on a permanent basis.
"There was a lot of competition for his signature but Adam loved his time working with us last season and believes this is the right place for him to develop as a player. He is young, talented and enthusiastic and a great addition to our squad.
"He was loved by our supporters during his spell with the club last season and I'm sure they will be delighted to see him back in a Barnsley shirt on a permanent basis. It's a great coup to bring him to Oakwell."
Liverpool-born Hammill has progressed through the ranks at Anfield and has spent loan spells at Dunfermline, Southampton and Blackpool before arriving at Oakwell last February where he made 14 appearances.