As @trubandloki linked, I recently had a thread on this.
I’ve tried banking bedding (I don’t think I do enough), have tried 2x4s along the wall so he has some footing to un stick himself, which works but doesn’t prevent him from casting himself (and subsequently busting his dutch door every time, because he gets cast in the same place).
Two things have worked for me - 1 was placing a straw bale on the wall that he casts himself on (I tied it to the wall with bailing twine). The straw bale lasted about a week before he realized it was a blast to play with and he broke the twine and scattered the straw throughout his stall. But IT WORKED. The other thing that has worked, or seems to have, is beginning ulcer treatment. I can’t afford gastroguard for a month, but I’m doing what I can. I got ulcer guard and began giving 1/2 tube each night, along with aloe juice (because its cheap and so if it does nothing, who cares). While on the ulcer guard he didn’t cast himself at all. I ran out the last few days and he cast himself once last night. My Sucralfate and Omeprazole from Abler just arrived tonight so I will start him on that tomorrow and I’m hoping it helps.
My plan now if the ulcer treatment doesn’t continue to help is to get another straw bale but to put it in a bale bag so hopefully it will be boring to him and he will leave it alone. Last resort will be to try a surcingle.