Gym, tan, rehab! In his new memoir, Reality Check, Mike “The Situation” Sorrentino opens up about his years-long addiction to painkillers.

“It had all begun by taking a pill here or there just to feel good and experiment,” writes the Jersey Shore star, 41. “But eventually the dream turned into a nightmare.”

Mike brought 500 Percocets with him to film ​season 2, and when they ran out, he found an unlikely supplier: a tanning salon owner. “After I finished tanning, I would place his cash under the towel and go about my job with a fresh stash of pills hidden in my boxers,” Mike says.

His addiction soon became evident not only to production but also to Jenni “JWoww” Farley, who confronted her costar on camera about his pill problem. (“MTV depicted our fight in such a way that the audience couldn’t tell what we were fighting about,” he notes.)

Mike even brought painkillers to film ​season 4 in Italy — he was in withdrawal when he headbutted the concrete wall — and had a drug dealer mail him Percocets while he shot Dancing With the Stars. All in all, Mike estimates he spent about $500,000 on drugs before finally getting clean in 2015.

“In my younger years, I didn’t know how to control those demons, and too often I lost the battles,” he writes. “But in the past eight years of sobriety, the tides have turned. I refuse to lose the war, though I still fight these battles every day.”