(CNN) -- "Californication" star David Duchovny made headlines for voluntarily entering rehab last week. But it wasn't for drugs or alcohol. It was for another dependency, one that affects millions of Americans but is seldom discussed: sex addiction.

While sex can be healthy for a relationship, some people develop an addiction to porn, affairs, and other behaviors.

Sex addiction, also called compulsive sexual behavior, is like a gambling compulsion or alcoholism: It's about devoting your free time to a behavior that you cannot stop, even if you damage relationships or prompt other negative consequences. That could mean extensively using pornography, having affairs, sleeping with prostitutes, and masturbating excessively, to the point where such behaviors get out of control.

If you think it's just about primal desire, think again. For many addicts, sex becomes a way to numb out painful feelings, kill time or stop feeling lonely, says Kelly McDaniel, licensed professional counselor in San Antonio, Texas, and author of "Ready to Heal: Women Facing Love, Sex and Relationship Addiction."

"Most people I talk to get to the point where they don't even like sex," said McDaniel, who has no connection to David Duchovny and did not speculate about his specific situation.

Who are sex addicts?

Sex addiction is estimated to affect 3 to 6 percent of adults in the United States, according to the Mayo Clinic, but the American Psychiatric Association has not classified the condition in its diagnostic handbook. Sexhelp.com, run by psychologist Patrick Carnes, provides an online test to help people determine if they have a problem.

The Internet, providing endless opportunities for porn-watching and cybersex, has fueled a surge in cases of sex addiction, experts say.

"We're seeing it with epidemic proportions now, particularly with regards to cybersex," said Mark Schwartz, psychologist and former director of the Masters and Johnson Institute in St. Louis, Missouri. "There isn't a week that goes by where I don't get two calls" about sex addiction.

Don't Miss

Therapists have recently seen more women with the condition in connection with Internet porn, which has become a "gender-neutral" addiction, McDaniel said. Before, female sex addicts generally tended to have affairs or become sex workers, she said.

Experts acknowledge that people who have affairs or use pornography are not necessarily sex addicts. Such pastimes form an addiction when they generate negative consequences for a person's relationships, take over free time and become impossible to quit.

Where does it come from?

About 80 percent of sex addiction cases have sexual abuse or emotional trauma in their backgrounds, said Doug Weiss, therapist and executive director of the Heart to Heart Counseling Center. Schwartz also noted that huge numbers of people coming forward as sex addicts have been abused, assaulted or raped.

"When you have abuse in your background, you're less likely to trust people, [and] you're more likely to turn to something like sex addiction as a manifestation," Schwartz said.

Feelings of neglect as a child -- whether from divorced parents or parents who both worked and didn't spend a lot of time with their kids -- may also lead to sex addiction, Schwartz said.

Research into the neuroscience of sex addiction has not been conclusive, the Mayo Clinic said. Naturally occurring chemicals in the brain such as dopamine and serotonin do contribute to sexual functioning, but it's not clear how they are related to sex addiction. McDaniel said these two chemicals are lower in the brains of children who have suffered abuse, which may explain why some of them use their own bodies -- or, in other cases, food -- to increase dopamine and serotonin levels.

A lot of teenagers develop their sexuality with pornography, and then find that relational sex isn't as satisfying, Weiss said. Porn gives them a "very strong chemical hit," and alters ways of thinking about sex, somewhat like the classic "ring the bell, feed the dog" stimulus-response mechanism. Addicts thus learn to become sexually attached to objects, and have trouble getting the same kind of satisfaction from sex in a relationship, he said.

For many people, especially women, sex addiction occurs in tandem with another problem such as an eating disorder, drug or alcohol addiction, McDaniel said.

How does treatment work?

A good treatment center will review the reasons why the addiction has come about, along with the brain chemistry of it, McDaniel said. A premier rehabilitation facility would have a combination of individual and group therapy, 12-step support, and possibly psychiatric medications such as antidepressant medications if necessary.

Health Library

MayoClinic.com: Compulsive sexual behavior

The 12-step programs, which have components that parallel Alcoholics Anonymous, are the most widely used form of treatment, said Sam Alibrando, therapist and consultant in Pasadena, California. They involve having a sponsor and being available for others in the group at any time. Anecdotally, however, they work less well than AA because sex is harder to give up, said Alibrando, author of "Follow the Yellow Brick Road: How to Change for the Better When Life Gives You Its Worst."

"Treatment is long-term, and it's not easy," McDaniel said. "I really recommend that a woman or a man find someone who's trained and understands that sex addiction is a brain disease and does not further the shame that comes with this disease."

Unlike drugs or alcohol, the goal of sex addiction therapy is usually not abstinence, but rather learning to have sex in a relationship, experts say. Similarly, someone who recovers from an overeating disorder does not stop eating entirely but learns how to manage diet. Marriage counseling often becomes part of the treatment, Weiss says.

The goals of recovery vary for different people, says Alibrando. He's currently treating a couple in which the wife cannot tolerate her husband even looking at other women. On the other end of the spectrum, he has treated couples in which a woman will buy her boyfriend pornography.

"The spectrum is so wide in terms of where people draw the line," says Alibrando.

Some recovering addicts join support groups requiring that members only have sex with their partners, even prohibiting masturbation.

What's after recovery?

Weiss considers himself a former sex addict, having recognized his problem in his early 20s. Women weren't making him happy; he was using pornography and felt "in conflict" about it.

Now, he runs a resource Web site for recovery at sexaddict.com, along with three-day intensive workshops to jump-start recovery for sex addicts.

Weiss said he's proud of Duchovny for voluntarily seeking help, apparently without prodding from press reports or lawsuits.

"This kind of person who decides to get recovery for themselves without getting exposed" is "likely to get better," he said. "People who voluntarily get better have a much better chance of staying well."