I find that the secret is to keep my beer consumption under a six-pack before riding with no hands.
Seriously though, sometimes the bike can make a huge difference if it has twitchy handling, deep section rims in the wind, wheels that are not true, a wheel that is not seated well in the dropouts (and is therefore pulling to one side), or a headset that is pitted or incorrectly adjusted.
If none of these seems to be the case, just keep trying (on smooth roads with no traffic) and you will get the hang of it. Relax and try to look ahead instead of staring down at your handlebars.