Antiviral medication: Cold sores are caused by a virus, so antiviral medications are used to treat them. Your dermatologist may prescribe medication that you: Apply directly to the sores, such as docosanol cream or acyclovir cream. Take by mouth, such as acyclovir, valacyclovir, or famciclovir.