He only joined Saints last season, arriving on the South Coast for a fee of around £8.5m from French club Lyon.
The 6'2" centre-back started his career at Dinamo Zagreb, spending two seasons on loan at Inter Zapresic before establishing himself in the Croatian giants' first team.
Lovren said it would be "something special to play at Anfield" as the club announced the deal on their website and Twitter.
"It's a dream come true," he said on the club's website. "I'm happy and glad to be here. I'm proud and can't wait to start.
"I know we have millions and millions of supporters - Liverpool is more than a club.
Dejan Lovren (Reuters)
"After I played at Anfield last season, I said to myself: 'One day I hope I'll be able to play here for Liverpool'.
"The fans will know from the first minute that I'm a player that will give 100 per cent on the pitch."
Liverpool finished second last season and are spending big after selling Luis Suarez to Barcelona for £75m.
They have made five signings so far this summer, buying Lazar Markovic from Benfica and Emre Can from Bayer Leverkusen.
A Liverpool statement read: "Liverpool Football Club are delighted to announce the signing of defender Dejan Lovren from Southampton.
"The 25-year-old Croatian international today put pen to paper on a long-term deal with the Reds after completing his medical."
Although no transfer fee was announced by either club, Southampton confirmed it was a "significant fee" with reports putting the figure at £20million for the centre-back, who played all three of Croatia's matches at this summer's World Cup.
He also scored the winning goal for the Saints against Liverpool on Merseyside in the 2013-14 Premier League campaign.
On that previous appearance at Anfield, Lovren added: "Jose Fonte, my defensive partner at Southampton, told me to listen to 'You'll Never Walk Alone' before the first whistle and to enjoy the moment.
"It was really amazing - I had chills on my arms and it's something that I will never forget. I want to listen to that song every other weekend."
- Sports & Recreation
- Dejan Lovren
- Adam Lallana
- Rickie Lambert