Huff's deal is worth $6 million over the length of the contract.
Huff, the seventh overall pick in the 2006 draft, had 56 total tackles, two interceptions and 13 pass breakups last season for the Oakland Raiders.
Huff's best season was in 2010 when he was named AP second-team All-Pro after recording 94 tackles, four sacks, three forced fumbles and three interceptions.
Huff was set to make $4 million in base salary and $4 million in a roster bonus when he was let go by the Raiders. He visited the Dallas Cowboys before agreeing to a deal with the Ravens.