The three-time Pro Bowl defensive tackle was convicted in July of raping an intellectually disabled woman at gunpoint in April 2015. Prosecutors said the woman was visiting Stubblefield's home to interview for a babysitting job.
Stubblefield, 45, was also convicted on two other counts, including false imprisonment. He will have 60 days to appeal the sentence.
Defense attorneys say Bocanegra improperly blocked their main argument that the woman had been paid for a consensual sexual encounter.
At trial, prosecutors called two female witnesses who said they'd also been assaulted by Stubblefield.
"'No' meant nothing to this defendant," Deputy District Attorney Tim McInerney said after Thursday's hearing. "Based on his status, I think he was never held accountable for prior criminal behavior. Today, he was properly held accountable."
Stubblefield was drafted by the 49ers out of the University of Kansas in 1993 and played 11 seasons in the NFL with San Francisco, Washington and Oakland. He won Super Bowl XXIX with the Niners in 1995 and was named the NFL's Defensive Player of the Year in 1997. He was a Pro Bowler in 1994, 1995 and 1997 before retiring in 2004.