"Pretty Little Liars" star Brandon Jones will be doing some jail time after all in his gun case, but it won't be for nearly as long as it could've been ... TMZ has learned.

The L.A. County DA tells TMZ Brandon pled no contest Monday to one count of misdemeanor assault with a firearm in his gun case from last year and was sentenced to 180 days in jail.

We broke the story ... Brandon was originally facing 5 and a half years in prison for allegedly pulling a gun on a neighbor during an argument he got into with the guy.

Brandon was also sentenced to 3 years probation, 30 days of community labor and 26 anger management classes in the plea deal. 

Not even Andrew got it this bad on the show.