How can I fall asleep during a cavity filling to avoid pain?

Local anesthesia. Being asleep will not ensure you have no pain or discomfort. Ask for a local anesthetic that will make the procedure completely pain free. If your dentist uses 'laughing gas\nitrous oxide\sweet air' this will relax you as well for the procedure.