It would help to have some more/better photos, but I can tell what I see with this one.
It looks like you have a lot of grip in your knee and not enough through your calf and ankle. The horse's motion causes your knee to act like a fulcrum and sends your hip and upper body forward.
So first you need to re-educate your leg and put more grip down through your calf. It's all right if your knee rests on the saddle, but it should not be gripping - your knee needs to open and close and retain some shock absorption.
Next, practice correct two point on the flat at the walk, trot and canter, and practice moving from sitting or posting into two point and back, concentrating on using your hip joint and keeping your crotch over the center of the saddle.
Then try the rider's push up exercise - find a good, secure two point where you're balanced with relying on the horse's neck. Fold your hip until your chest touches the horses mane, then unfold and come back up, maintaining your leg and seat position.
Finally, work through grids and gymnastics, both with and without strirrups, and concentrate on letting the horse's motion push you out of the saddle/produce the hip folding rather than jumping up the horse's neck.
It's a hard habit to correct, but it can be done. Good luck!