Balance is a tricky thing to teach people, but it's SO important to learn. The usual advice to get away from the death grip on the bars and get secure on the pegs is to "grip with the knees". I think the fastest way to learn balance and how to stay with the bike is learn to relax first and then add grip in. Grip is tension, tension is stiffness and stiffness is slow reflex. I'm not saying "don't grip" but rather saying telling a person who has death grip issues to grip with the knees just transfers the death grip to the legs. Legs have to be relaxed and boingy to be suspensiony and make all those little micro adjustments/responses for balance. Though, obviously there has to be some muscle tension in the legs or else you couldn't be standing up at all. It's all about...balance.
When I was a kid learning to ride horses I got the tough love crash course to learn the balance thing--hard smooth saddle or no saddle, roughly gaited spooky horse, and drill sergeant ridicule if you grabbed leather, so it was more face saving to just fall off (On the other hand falling off is actually the fast way to learn to not be so afraid of falling off...and you learn limits and what the actual edge is instead of going so far before you choke). The ONLY way to learn to stay with it was to let go and relax. When you relax then you can feel the motion(you're not fighting it to keep YOUR balance, or more accurately what you THINK your balance should be) and anticipate how the horse will move(seat time gives you motor memory and understanding)--that whole "be one with the horse" voodoo.
The process I took with the bike was to get the whole body relaxed sitting, then with standing I did it in the easy stuff first, getting/DOING that sense of weight on the pegs, no weight on the bars and relaxed hands, maintaining relaxed boingy joints in the legs, and keeping a smooth throttle. Then I played with acceleration/deceleration getting in sync with how my cg responds and finding the balance and learning/feeling how to be in sync with accel/decel and not just be trying to keep up. Also being a gear up will smooth out the jerky whap that is hard to deal with in the beginning. Knees/lower legs are up against the bike, toes turned in a tad(your knees won't be so apt to slide along the shrouds). You need to find that neutral/default position where you are completely balanced fore and aft, side to side.
Next you can work on riding on one leg and feeling secure and balanced with that. Lots of benefits come with that skill: just plain better balance all the way around, better use of pushing hard on the outside peg, if a foot gets knocked off no "oh CRAP!" moment, better body suspension in rough corners and more finesse with the back brake.
When you bring knee grip into it it's a light grip(with potential for instant and fleeting vice grip when needed). You gotta learn to grip with the inner thigh and be relaxed with the rest of the leg/core muscles. Think about and feel what your individual muscles are doing, then listen to how it all works together as a whole.
I also have to NAG and say that building strong legs and core(squats! deadlifts!) will make all this WAYWAYWAY easier to achieve. Weakness also makes for tension. Bad wobbly unusable tension. And then you get tired and try to compensate by hanging on cuz you feel insecure.
A little extra thought and analysis and visualization goes a long way to understanding for riding well and just plain improving faster. People advise a lot to "just ride" and there is the value of voluminous seat time to get the hang of something(if you have the time to fart around), but I think without direction oftentimes that just degenerates into reinforcing bad habits. Some folks do have innate talent for this, but most don't naturally muster good skills on their own. I think it's worth it to put the effort into understanding and building good habits then you can get the real benefit of seat time which should be about mastering efficiency and good skillz and nailing it to the freakin wall with your monster fist of grrrr.