I would say the best ways to gain confidence are to a.) ignore your ego, b.) try new things, c.) live with a purpose.
Your ego keeps you from doing a lot of things. Have you ever taken LSD? You get into this place where nothing matters but the present moment; you are on drugs but you have your senses entirely about you; some people (ie Huxley) would argue that you are even more in-tune with your senses. What I am getting at here is that your mind and your ego mess up your intuition and spontaneity.
Stepping out of your comfort zone is a big one. You need to constantly improve yourself and live your life. Do you lift weights? No? You should go to the gym right now. Want to start mountain biking? Go do that. Basically if there is something you want to do, you need to do it.
That all leads into living your life. Confidence is built on the inside, but it also requires a certain amount of validation from your peers. You might be an amazing painter, but if you don't publicly display your art and get random validation, you'll never actually know how good you are (or how bad). You need to find and pursue and do activities that allow you to experiment and interact with other human beings. This will build confidence. When you find an activity which you excel at or love (or even better at, both), you need to follow it with all of your heart.
You need to take risks. Risk taking will build confidence. And you'll fail. Weak men cry about failure and spend more energy attempting to deflect failure than trying to change and learn. Strong men fail all the time and learn from it and perpetually change.
The easiest way to build confidence (in my opinion) is to eat healthy and work out. It's like a self-fulfilling prophecy. I used to have drug problems; then I said "this is stupid" and started working out. As I got better and better looking physically my confidence exploded and I started doing more and more things until I ultimately built a life for myself which I love being a part of. Everything started with trying to run around the block, which I couldn't do when I started.