Jeremy Hammond was sentenced on Friday.
He pleaded guilty to hacking charges in May.
The federal government says the attacks were carried out by the loosely organised hacking group Anonymous.
Targets included the US Senate.
Hammond called it civil disobedience.
More than 250 people wrote letters of support.
Prosecutors say the hackers stole confidential information, defaced websites and temporarily put some victims out of business.
Authorities say the crimes affected more than a million people.
Hammond was caught with the help of Hector Xavier Monsegur.
The hacker, known as Sabu, helped law enforcement infiltrate Anonymous.