The road to become good at programming is the same as for singing or playing music: practice, practice, practice. If you spend enough time regularly developing software for several years, chances are you will become good at it - be it inside or outside working hours.
Now, apart from spending more time practicing, there is another reason why professionals usually become better than amateurs in a certain sense (in music as well as in programming). If you are a professional, you have to do tasks which you don't necessarily like, but belong to the wider job of developing software (e.g. testing, discussions with customers, writing documentation, setting up dev/build environment, writing build scripts etc). And every now and then you are also pressed to step into unfamiliar areas, to learn new languages or platforms. As an amateur, you aren't forced to do anything you don't want to, which makes it likely that you stay within your comfort zone for most of your life. In other words, you can easily become limited to one or a few specific areas you are most fond of, and miss a lot of opportunities to learn and grow.
OTOH many professional developers fall into this as well, staying at the same company doing the same routine job hardly learning anything new for decades... So the key to become better is your attitude. If you keep learning, and consciously look for opportunities to move out of your comfort zone into new, unfamiliar territory, you will eventually outperform those swarms of slowly fossilizing "professionals". A good way to this may be contributing to some open source projects.
A recommended reading is The Pragmatic Programmer: From Journeyman to Master, with lots of great and very practical advice on how to keep becoming better.