The FARs (Federal Aviation Regulations) are somewhat ambiguous about this. While there are rules relating to the amount of rest needed before flight and the length of crew duty days, they don't specifically forbid napping on the job. However, in the spirit of most government regulations of this nature, if it doesn't specifically say you can do something, it's a sure bet that you can't. The FARs also provide a convenient catch-all regulation for dealing with any situation that is not specifically mentioned. That is the "careless and reckless" provision of Part 91 under which sleeping might be covered. And lastly, it should be generally expected by your employer that you stay awake on the job!
And yet, fatigue as it relates to aviation is a huge concern. Fatigue is now recognized as a physiological phenomenon rather than a moral failing. And the implications for flight safety are huge. Fatigue was cited as a factor the crash of Colgan Air Flight 3407 in February of 2009 though the NTSB declined to list it as a cause. While the primary cause of the crash was the captain's mishandling of the aircraft resulting in a stall, fatigue of both the captain and first officer likely exacerbated recognition and recovery of the stall. Indeed, the effects of fatigue are well known and can seriously degrade task performance and situational awareness. Studies have indicated that being awake for 24 hrs degrades performance as much as a .10% blood alcohol content. One poor night of sleep in the crash pad and your pilot may as well have a beer before coming to work.
As a result of the Colgan crash, Congress passed the Airline Safety and Federal Aviation Administration Extension Act of 2010. This law required the FAA to overhaul existing flight and duty time regulations, and also to require the establishment of a fatigue risk management plan at all commercial airlines. The new regulations, which will be implemented soon, include changes to duty hour limitations based upon when a pilot reports to work in an effort to respect circadian cycles. Fatigue is notoriously difficult to self diagnose and the new regulations acknowledge this. There's a lot to like in the new regulations, but as per normal when dealing with any political process, much mischief has also snuck into the law masquerading as safety improvements.
In any industry that is populated by older more mature companies, but also has younger, nimbler upstarts unencumbered by legacy labor contracts, a proven strategy is to try to saddle the competition with the same burdens that exist in the older companies. Hence what one might see is an alliance between the established players, their labor unions, and ever willing government regulators to hamstring new entrants. And sure enough, that is in evidence in the new rest regulations. For instance, while the pilots of some low cost carriers may fly 80 or more hours in a month, pilots for the large network airlines fly 60 or fewer hours monthly. So rather than fight their own unions for increased work rules, the legacy airlines petition the government under the rubric of safety to make their competitors fly their pilots less thereby driving up costs. 80 flight hours at a six flight hour work day, which is not unreasonable, means about 14 days at work.
Overall, though, the new regulations should have a positive effect in lessening the exposure of the flying public to the dangers of fatigued pilots. One of the most beneficial methods of combating fatigue though, didn't make the final cut. And that is naps. It has been long recognized that a short nap can produce dramatic improvements in performance lasting up to several hours. Nasa has done extensive research into the science of naps for pilots and astronauts and has found that while there are drawbacks such as sleep inertia immediately following a nap, the benefits are palpable. The FAA however, citing a lack of data, has declined to regulate for controlled napping. This is probably one part science and two parts politics.
All the attention given to fatigue though comes down to a simple fact of life. Sometimes you just get tired and it may or may not have anything to do with how much sleep was achieved the night before. Having a bowl of your favorite chow mein followed by sitting on the sunny side of the plane in mid afternoon during a long cruise might just have you nodding off, and there's little to be done about it. So while certainly no napping in flight occurs, on occasion one pilot has been known to let the other take both the controls and radio in order to do some enhanced overhead panel study, or perhaps to check the eyelids for leaks. All in the name of safety, of course.