It's much more about the rider than the bike. Ride lots. Train hard.
But since the question's about the bike... Price vs. weight/performance tends to be a logarithmic curve. I borrowed the attached image from a web site about audio equipment, but the same premise applies to bikes and a lot of other things. You can oftentimes get something like 80% of the performance for 20% of the price. Once you start getting past that 80% mark, though, it gets more and more expensive. Find the spot on the curve that you're comfortable with, or that your budget allows.