Modafinil is used to treat excessive sleepiness caused by narcolepsy (a condition that causes excessive daytime sleepiness) or shift work sleep disorder (sleepiness during scheduled waking hours and difficulty falling asleep or staying asleep during scheduled sleeping hours in people who work at night or on rotating shifts). Modafinil is also used along with breathing devices or other treatments to prevent excessive sleepiness caused by obstructive sleep apnea/hypopnea syndrome (OSAHS; a sleep disorder in which the patient briefly stops breathing or breathes shallowly many times during sleep and therefore doesn’t get enough restful sleep). Modafinil is in a class of medications called wakefulness promoting agents. It works by changing the amounts of certain natural substances in the area of the brain that controls sleep and wakefulness.
Modafinil comes as a tablet to take by mouth. It is usually taken once a day with or without food. If you are taking modafinil to treat narcolepsy or OSAHS, you will probably take it in the morning. If you are taking modafinil to treat shift work sleep disorder, you will probably take it 1 hour before the beginning of your work shift. Take modafinil at the same time every day. Do not change the time of day that you take modafinil without talking to your doctor. Talk to your doctor if your work shift does not begin at the same time every day. Follow the directions on your prescription label carefully, and ask your doctor or pharmacist to explain any part you do not understand. Take modafinil exactly as directed.
Summary from MedlinePlus.gov, click for more information.