New general manager Reggie McKenzie had decided Tuesday to hire Allen to replace the fired Hue Jackson as head coach. The two sides finalized the details Thursday, a person familiar with the process said on condition of anonymity because the team is not publicly discussing the search.
CSNCalifornia.com first reported the length of the deal.
Allen is Oakland's seventh head coach since 2003. The Raiders have gone nine straight seasons without a winning record or a playoff berth, just missing out on the AFC West title on tiebreakers with an 8-8 record last season.
The 39-year-old Allen will be the first new Raiders coach to come from the defensive side of the ball since late owner Al Davis hired linebackers coach John Madden in 1969.
In his first season as co-ordinator in Denver, Allen helped the Broncos improve from allowing a league-worst 29.4 points and 390.8 yards per game to ranking 20th in yards (357.8) and 24th in points (24.4) this season on the way to an AFC West title.
Before serving as Denver's defensive co-ordinator last season, Allen spent five years as a defensive assistant in New Orleans and also coached for Atlanta.
The Raiders are coming off one of their worst defensive seasons ever. Oakland had franchise worsts in touchdown passes allowed (31), yards per carry (5.1), yards passing (4,262) and total yards (6,201), while giving up the third-most points (433) in team history.
The Raiders joined this year's Tampa Bay team as one of the four teams to allow at least 30 TD passes and 5.0 yards per carry in a season, a distinction last reached by the 1952 Dallas Texans. The Raiders also became the sixth team since the 1970 merger to allow at least 2,000 yards rushing and 4,000 yards passing in a season.
The Raiders also set an NFL record last season with 163 penalties for 1,358 yards.