I ran out of chain lube a while back and needed to take care of the chain. I had just changed the oil in my car and had some used Mobil 1 10w-30 in the garage. I put it on the bicycle chain with a tooth brush and wiped off the excess. Worked great, lasted a long time. Actually lasted longer than the bicycle specific lube. I'm not going back to traditional chain lube.
WD 40 is definitely a lubricant, but too thin for bicycle chain life. There's a longer discussion with Langmuir's theory of lubrication and boundary layers, but just use what makes you happy.