But he will attend a human trafficking class, do up to 100 hours of community service and pay about US$9000 in fees and fines in order to remain free to walk the fairways.
Gainey, who won the PGA's 2012 McGladrey Classic in Georgia, had a form dip and lost his tour card, moving onto the Korn Ferry Tour.
He recently had his first win on that tour, in the Bahamas, and referred to the prostitution arrest in his victory speech.
"With the injuries that I've been through, the other troubles that I've had … I'm very lucky and very blessed. This means everything," said Gainey, who is on 11 months of probation rather than jail time.
He also talked about getting his "life back on track" and said: "My wife, I love her to death. Her and the boys mean everything."