One of the best ways to avoid flat tires is to keep your bike well-inflated. Check your tire pressure regularly, and top off the air as needed. You can find the recommended pressure for your tires on the sidewall.
Another way to reduce flats is to avoid riding in areas where there is a lot of debris or glass. If you must ride in these areas, try to stay towards the center of the road where there is less chance of hitting something sharp.
You can also buy puncture-resistant tires, which are made with thicker rubber and Kevlar fibers. These tires cost more, but they can help you avoid flats caused by sharp objects.
Finally, always carry a patch kit with you so that you can fix a flat if necessary. With these tips, you should be able to minimize your risk of getting a flat tire while biking.