A way to get balanced while riding bareback is riding without the reins. Do you have a round pen? If not, see if you can get someone to longe the horse while you ride. When you say that you 'lean forward' it sounds as if you're using the reins to balance.
Anyway, at the walk, tie the reins and let them rest on the horse's neck (sort of a safety precaution, in case the horse bolts which it shouldn't but that's a totally different subject
). Let your arms hang at your side and try to get a feel for how the horse walks.
My problem was tensing up my shoulders, which in turn would tense up my legs in an attempt to 'hold on' but it just gives you a bad seat if you squeeze with your legs. The goal was to sit straight, relaxed, and not to squeeze. Look at it this way: to relax my shoulders I would force my hands to stay open. First my hands would clench, then my shoulders, then my legs...it's all connected...
Once you have the walk down sitting normally, try trotting. The trot is hardest because it's so bouncy, IMO, but just keep up the relaxed position because if you're relaxed you won't fall off.
I'd post more but this is kind of long already--best of luck!