Contrary to some of the answers, experience is not the only requirement to becoming an "expert". I think most people in every industry (not just programming) do not become expert in their field. They become competent and efficient, but they do not become anywhere near as good as they could be.
The reason is that experience is not enough. You need expert advice. You need to learn how to do things from someone who is an expert.
Fortunately for us, there are many resources for programmers to become expert. Probably the best one is books. Another outstanding resource is programmers.StackExchange.
Spend most of your time writing code, but also spend some of it reading and integrating the knowledge from books like Clean Code http://www.amazon.com/Clean-Code-Handbook-Software-Craftsmanship/dp/0132350882. You can find the best books by analyzing the reviews on Amazon, checking this site, and Stack Overflow.
If you invest enough time to learn and use the information in 2 or 3 books per year, it will greatly increase your skill. Also, figure out a way to record and remind yourself of everything that you learn. Otherwise it will be difficult to really know and use the information.
Pay attention to the topics that expert programmers are interested in: design patterns, unit testing, career choice, etc. Look at the world (or at least your job) from the perspective of an expert programmer.
When you are given a task to code, stop and think about it for a little while. Ask yourself some questions. What have I learned that can help me? What are the risks? What is the best approach? What are some different algorithms I can use? How much time will it take for the program to execute? What is likely to be the CPU bottleneck? What functionality could change or be added?
Hope this helps.