It's possible to get a prescription filled at 3 a.m. in the Washington area -- but it may take a painfully long period of time getting to and from the pharmacy.

Only four drugstores here have pharmacists on 24-hour duty. The Peoples Drug Stores chain has one store in the Northwest section of Washington, one in Prince George's County and one in Falls Church. The fourth all-nighter is Drug Fair's Buckingham store in Arlington.

Another 26 drugstores operated by Dart Drug are open 24 hours, but do not have pharmacists on night duty. However, these stores -- which are scattered through a number of communities in Maryland and Virginia -- do sell aspirin, cough syrup and other off-the-counter medicine to those who become ill and can't make it through the night.

The number of all-night drugstores has been shrinking in recent years, because of increases in operating costs and in crime, according to local store officials and pharmacists.

Dart Drug, for example, eliminated the 24-hour pharmacy service about two years ago. Now prescriptions can be filled only during the daytime and evening hours, generally from 9 a.m. to 9 p.m.

"Four or five years ago, it was a big thing to be an all-night store -- and it seemed like every other pharmacy was open all night," said Stan Brown, a pharmacist who is president of the Pringe George's and Montgomery County Pharmaceutical Association. "But with the increase in crime and the economics of paying a pharmacist $12 to $15 an hour to man a place and then possibly getting only some paper work done (because of a lack of customers with prescriptions to fill), there's no way to justify that store staying open all night," Brown said.

The Peoples chain, the area's largest, traditionally has kept three pharmacies -- "one downtown and two around the Beltway" -- staffed around the clock to fill prescriptions, according to vice president Joseph Pollard.

And Drug Fair's Buckingham store has been virtually open for 40 years, a company official said. She said Buckingham began in the 1940s as a 24-hour store and has not shut since. Even remodeling work now under way at the store has not interfered with its day-and-night hours.

Here are the addresses and telephone numbers of the four 24-hour pharmacies:

Washington: Peoples Drug Store, 1121 Vermont Ave. NW, 628-0720.

Prince George's County: Peoples, 7939 New Hampshire Ave., Langley Park, 301-434-3121.

Arlington: Drug Fair Buckingham, 256 N. Glebe Rd., 703-527-2600.

Falls Church: Peoples, 8124 Arlington Blvd., Yorktown Center, 703-560-7280.

None of the 26 all-night Dart Drug stores (with pharmacy service only until about 9 p.m.) is in the District of Columbia. Maryland stores are in Bethesda, Silver Spring, Waldorf, Upper Marlboro, Suitland, Bowie, Lanham, Gaithersburg, Kensington, Wheaton, Oxon Hill and Adelphi. Virginia stores are in Annandale, McLean, Falls Church, Manassas, Alexandria, Bailey's Crossroads, Woodbridge, Fairfax, Burke, Charlottesville, Winchester and Vienna.

To locate the nearest all-night Dart Drug, check the telephone Yellow Pages or call the company at 772-6000 or 772-6016. But those offices close at 5:30 p.m.