Cunningham, who resigned from Congress in disgrace last year, was spared the 10-year maximum by Larry Burns, US district judge.
Cunningham was immediately led away.
Cunningham pleaded guilty to accepting bribes from defence contractors and others in exchange for steering government contracts their way.
They included a Rolls-Royce, a yacht, homes, travel, meals, Persian rugs valued at $40,000 each and antique furnishings.
Among Cunningham's acquisitions was a 7628sq ft mansion in Rancho Santa Fe, one of America's wealthiest communities. The home, bought with the help of bribes from defence contractors, was sold in December for $2.6 million.
It was unknown how much of those proceeds went to Cunningham.
Cunningham, a Republican, represented San Diego-area districts for 15 years. The scale of his wrongdoing surpasses anything in the history of Congress, according to official Senate and House historians.
Before Friday, the longest sentence imposed on a current or former member of Congress in the past four decades had been eight years, handed to former legislator James Traficant, an Ohio Democrat, in 2002 for taking payoffs, and to former legislator Mario Biaggi, a New York Democrat, in 1988 for extorting nearly $2 million from a defence contractor.
Cunningham, 64, was ordered to pay $1.8 million in restitution for back taxes and forfeit an additional $1.85 million worth of in-kind valuables received through bribery.
"You weren't wet. You weren't cold. You weren't hungry and yet you did these things"
US District Judge
Burns said Cunningham must pay the restitution at a rate of $1500 a month while in prison and $1000 monthly when he's released.
The judge credited Cunningham for his military service and for standing in front of the courthouse in November and taking responsibility for his crimes and resigning from Congress.
Looking at Cunningham, the judge told him: "You weren't wet. You weren't cold. You weren't hungry and yet you did these things.
"I think what you've done is you've undermined the opportunity that honest politicians have to do a good job," the judge said.
"The amount of money involved emasculates prior bribery crimes."