He and a co-defendant were convicted of breaking into computers owned by technology services giant CSC by a Danish court.
They downloaded police and social security files from the computers.
Prosecutors said it was the "largest hacking case to date".
Soon after the sentence was announced, lawyers representing Mr Warg said they would launch an appeal.
Warg's accomplice was given a six-month jail sentence but walked free from the court, having served 17 months in pre-trial detention.
The initial hack attack took place in February 2012 and gave the pair access to the sensitive information, including social security numbers and police records, for about six months.
Defence lawyers said that, although the hack attacks were carried out using a computer owned by Warg, he was not the person that used it to steal the files.
Instead, they said, an unnamed hacker took over this machine and used it to carry out the attacks. Warg has declined to name this other hacker.
After considering evidence, the judge and jury in the case said it was "unlikely" that other people were responsible.
The court's decision is the third to go against Warg in the last five years.
He was deported from Cambodia in September 2013 to Sweden where he served a jail term for copyright theft because of his involvement with the Pirate Bay file-sharing site.
In a separate trial in 2013, Warg was sentenced to two years in a Swedish jail for hacking into a bank's computers. This sentence was reduced to one year on appeal.
In that trial, Warg and accomplice were found guilty of breaking into the computer systems of computer services firm Logica, which was doing work for Sweden's tax office and a bank. On that occasion his accomplice was put on probation.
In late November 2013 he was deported to Denmark to face charges in the CSC hacking cases.
Pirate Bay co-founder Gottfrid Warg has been sentenced to three-and-a-half years in prison for hacking into computers and illegally downloading files.