Ex-NBA star Sebastian Telfair has been sentenced to 3 1/2 years behind bars for possessing an illegal firearm in 2017 … TMZ Sports has learned.

As we previously reported … the 34-year-old former high school phenom was busted back in June 2017 in Brooklyn …. after cops found an arsenal of weapons in his car during a traffic stop.

Officials say the former Trail Blazer, Celtic, Clipper and Timberwolf (to name a few) had 3 pistols and what appeared to be a semi-automatic rifle.