I recently got a rain barrel and I was wondering if it is the cause for all the mosquitos in our yard and how to prevent them in the future.
If the top of your rain barrel is open, it is quite possibly the source of your mosquitoes. If so, at any big box store you can buy mosquito dunks, which are a doughnut shaped thing of bacillus thuringensis (I don't know if I spelled that right, and I bet not!). We have 55 gal. rain barrels, and 1/4 of a dunk in each barrel takes care of mosquito larvae. The BT has to be replaced every two-three months, depending on the amount of rain. When you don't see little brown granules floating in your barrel, it's time to replace with 1/4 of a doughnut.
Grow repellent sweet basil
If that is the source of your problem you will be able to see little larva hanging from the surface of the water. This is only when mosquitoes are breeding, which is also the only time your rain barrel is a problem.
Mosquitoes can lay eggs in even a small amount of water, so while you want your rain barrel to be used, just check around your yard to make sure there are no other areas where water can pool (eg a plastic cup or plastic bag that is holding even a centimeter or two of water). Even if the rain gutter is bent at some point and not letting water flow, this amount of water can be used by a mosquito for laying eggs.
My sister feels that more bugs (including mosquitos) also seem to have shown up after we added mulch to the yard. I don't know if that's really the case but there certainly are some mulch advertised as being repellent to bugs.
If The barrel will never be empty or stagnant, toss in a pair of the cheapest available goldfish. It's far cheaper than buying magic treatments.
cold_weather_is_evil has a good idea. My wife and I used to keep goldfish in the pooling area of our outdoor fountain. Before adding fish, it was a haven for mosquito larvae. After adding them, never saw a single larvae again.
Our goldfish even survived the winter outside without any food or warmth from us. We lived in northwest Florida at the time, though. We tried keeping them outside in the winter where we live now, but it proved too cold for them and they died, unfortunately.