Good news for Tampa Bay Buccaneers WR Josh Huff -- he just struck a deal with prosecutors in his gun case and will stay out of jail .... if he keeps his nose clean.
As we previously reported, the 25-year-old ex-Oregon star was pulled over in NJ back in Nov. for speeding -- but during the stop, cops say they found an unloaded gun, hollow point bullets and weed.
He was charged with unlawful possession of a weapon and was facing up to 10 years in prison if convicted.
But TMZ Sports has learned Huff accepted a conditional plea -- in which he essentially gets 6 months probation and, if he stays out of trouble, the charge will be wiped from his record.
If he screws up, Huff agrees to plead guilty and could face the maximum punishment.
Huff still has 2 charges pending -- DUI and tinted windows -- but his lawyer, Andrew Smith, tells us he's hopeful those will be dismissed.