I’m going to say no, but this doesn’t mean clean code doesn’t matter. It can make all the difference!
In my experience and research, both in witting this and reverse engineering hundreds of websites that rank, I’ve seen many top sites that do not pass validation perfectly (without any errors). Now this isn’t to say they are not fully CSS / XHTML driven websites. Many sites that are all CSS based may still fail W3C validation for one reason or another. For example using Google’s Website Optimizer will cause your site to fail validation sometimes.
The main difference in sites that have an advantge in code is they do not use many tables. It may not even mean they don’t have any, but that don’t have a bunch and especially not tables within tables. Looking at code and going line by line to be sure you’re using as little of code as possible is always going to be a benefit.
Why does Google or other search engines care? One, sites with clean code load faster. A faster loading site is going to give a better user experience. Remember, (always) Google wants to display websites that’ll be best for the user searching, in all aspects. Two, I believe Google thinks you probably have a more up-to-date, better developed website than someone with a mess of code. This seems to make sense and I like to think Google thinks logically sometimes (it helps me sleep at night.)
All in all, clean code matters. If you have a few W3C validation errors, life and rankings should go on. For fun try to validate some of the biggest sites. Almost none will pass.
