You may not remember when Claritin was a prescription drug. The patent for the nonsedating antihistamine for allergies expired in 2002 and the drug subsequently landed on drugstore shelves as an over-the-counter medication.

Last month, Nexium — the “little purple pill” used to treat acid reflux — went off patent. The generic version should be available soon, and in the future it likely will be available OTC.

Anyone looking for a break on the cost of medications knows generic and OTC drugs are more affordable. When patents expire, it opens the market for competition and better prices.

But since it is in the best interests of drug companies to keep prices high for as long as possible, they may tweak the formula, making the new, “improved” version of the drug ineligible for a generic substitution. A generic manufacturer may file a lawsuit before the patent expires and win exclusive rights to the drug for six months, while drug manufacturers may use the extra time in court to introduce new or similar drugs to the market.

According to a Consumer Reports survey, it can take six months to a year for prices to fall substantially lower than the prescription price, but it pays to be patient. Nexium, for example, is expected to drop from $275 for a 30-day supply to $137 by 2015 and $14 by 2017. Lunesta, a treatment for insomnia that also went off patent this year, already has a generic equivalent and is expected to drop from the $193 prescription price for a 15-day supply to $97 within a year.

Here are some things you can do to save the most on your medications:

Know your dates. Find out the patent expiration date for any drugs you are taking. You can't rely on doctors, because they may continue to prescribe medications that are available OTC. In addition, if you want a generic drug, make sure you ask your doctor to write a prescription for a drug that can be filled generically.

Don't depend on discounts. Drug makers may issue coupons for certain prescription drugs, but don't be seduced. A coupon may save you money on the purchase, but may result in higher insurance premiums later, Consumer Reports found. Choose generic drugs when possible. You can check the FDA website to find a generic equivalent for your brand-name drugs.

Comparison shop. As with anything, it pays to compare. Try GoodRx, which is available online or as a free app, to help you find the lowest cost prescription drugs. Even if you have insurance, GoodRx can help you beat your co-pay or find a low price on drugs that aren't covered.

Explore OTC drugs. As noted, many OTC drugs were once prescription-only drugs. There is no reason why you can't take them on a short-term basis for common ailments. Ask your doctor to suggest the proper dosage for OTC treatments.

Buy mass market. Secret shoppers from Consumer Reports found that stores like Walmart and Target beat drugstore chains and supermarkets on prices for brand-name and generic OTC drugs. If you do shop at drugstores, be sure to use loyalty cards and coupons to offset the higher costs.