Exposure and response prevention (ERP) therapy is a form of cognitive behavioral therapy (CBT), and is considered the gold standard treatment for OCD.
Essentially, ERP consists of working with a trained professional to create situations in which you repeatedly force your brain to confront what it claims is an emergency. You have to sit with your brain screaming that you need to take action (the compulsion) to neutralize the danger of the emergency (the obsession). Over time, you habituate and the distress fades. Your brain no longer claims that threat is an emergency.