There's not much to do to keep the water clean outside of changing it regularly. I generally change the water for my cats every morning.
With algae though, if it's growing back within the day, you'll have to take some steps to combat it and try and kill it off as much as possible.
It might be as simple as a good hard scrub. You have to get all traces of algae out so it doesn't have anything to grow back with. Unfortunately it really doesn't take much for algae to grow back, and if your water dish is plastic, the plastic is porous enough to keep tiny bits of algae protected
Dry it out. If you use another container for a few days, and let the one with algae sit in the sun dry. The dryness and heat should help kill off the algae. This isn't always the case though, as algae quite often goes into a dormant stage.
Bleach the container. Bleach should help kill off the algae pretty effectively, but you have to be extra sure that you clean all of the bleach out afterwards. Since it's a container that your dog is drinking out of, the last thing you want is for them to inadvertently drink some bleach water.
To prevent algae growth in the future, making sure the water isn't in any sunlight will be the biggest help. Direct sunlight not only promotes algae growth, but speeds it up. Keeping the water in shade will slow down the growth drastically, and will also help keep the water cooler throughout the day, so it's a win-win there.
You might also want to consider getting a water fountain. You can get some pretty large ones for dogs. What they do is run the water through a carbon filter with a small pump, so not only will the algae have difficulty growing due to the moving water, but that should also discourage most insects that would be attracted to still water. Any insects that would happen to fall in would get caught in the filter, which you would just change every couple of days. I would just make sure to spend the little extra money on a metal fountain, as I had gotten a plastic fountain first, and it was really difficult to keep clean.