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.
Of course, it's a solid deal for Gainey ... who was facing jail time after he was caught up in a major prostitution sting -- dubbed "Operation Santa's Naughty List" -- back in December.
As we previously reported, cops in Polk County, Fla., say Gainey offered money for sex acts to an undercover officer posing as a prostitute on Dec. 8, 2019.
In police footage of the alleged incident, obtained by TMZ Sports, you can see clear as day Tommy offering up $60 for a "quick visit" with the woman.
Gainey was arrested ... and at a press conference a few days later, Polk County Sheriff Grady Judd ribbed him over it all.
Polk Co. Sheriff's Office
"He's married. He told us that he was here for a charity golf event and it was to be, like, the next morning tee off. He didn't make it. He was a scratch ... We charged him with soliciting. He missed his tee time the next morning."
Gainey hasn't let it all affect him on the course ... he played lights out just days after his arrest -- and even won the 2020 Korn Ferry Tour season opener last month.