The commitment was scheduled to expire Dec. 7, but a judge ruled Tuesday that Gonzalez must remain at the facility until May 2021.
The extension was agreed to by the prosecution and defense.
Court records show Gonzalez had a history of bipolar disorder, alcohol abuse and seizures before the stabbing in Norwich in 2007 that nearly killed the victim.
Gonzalez was found not guilty by reason of mental disease to charges of assault, reckless endangerment and carrying a dangerous weapon.
Information from: Norwich Bulletin, http://www.norwichbulletin.com