The 20-year-old spent last season at Bradford City and impressed hugely despite the club's relegation from League One.
Now back with the Terriers, O'Brien is looking to make his mark in the second tier.
"It is great news for everyone that Lewis has signed his new contract," said Town head coach Jan Siewert. “I think that everyone has been able to see the benefits that his experiences at Bradford City last season have given him. He has come back to us with his confidence high and he can fit into our squad with his level of performance, as we have seen in pre-season.
“He is still only 20, so he definitely has space to improve further. That is an exciting thought, as we have already seen he can make an impact for us."
O'Brien appeared in all three of Town's pre-season friendlies in Austria. He is also expected to feature tomorrow night against Rochdale at Spotland.
The Littleborough-based midfielder is yet to play a senior competitive game for Huddersfield but he played 46 times for Bradford last season and scored four goals. Huddersfield have the option to extend the new contract, which runs until 2022, by a further 12 months.