Tommy "Two Gloves" Gainey's sex solicitation case is headed toward a happy ending for the popular golfer ... he just cut a deal with prosecutors to avoid time behind bars.
According to court docs obtained by TMZ Sports, Gainey agreed to serve 11 months of probation, take a human trafficking class, do community service and pay fines and fees.
In exchange for completing all of that, prosecutors agreed to drop his misdemeanor solicitation charge ... and even gave him the chance to end his probation early if he quickly meets the requirements of the deal.