The star of Zoolander was diagnosed with a tumour in 2014.
He says he now wants to share his story to lend his support for a controversial test which saved his life.
In an article on Medium, Stiller described the moment of his diagnosis as "a classic Walter White moment, except I was me, and no-one was filming anything at all".
He wrote: "I got diagnosed with prostate cancer Friday, June 13 2014. On September 17 of that year I got a test back telling me I was cancer free.
"The three months in between were a crazy roller coaster ride with which about 180,000 men a year in America can identify."
He said that after he was diagnosed, he researched high-profile men who'd survived and died from the disease.
"As I learned more about my disease (one of the key learnings is not to Google 'people who died of prostate cancer' immediately after being diagnosed with prostate cancer), I was able to wrap my head around the fact that I was incredibly fortunate.
"Fortunate because my cancer was detected early enough to treat. And also because my internist [doctor of internal medicine] gave me a test he didn't have to.
"Taking the PSA test (prostate-specific antigen test) saved my life. Literally. That's why I am writing this now."
The NHS says the PSA test is controversial because it's "unreliable" and "can suggest prostate cancer when no cancer exists (a false-positive result)".
It also says that while it can find aggressive prostate cancer that needs treatment, it can also find slow-growing cancer that may never cause symptoms or shorten life.
Ben Stiller says he isn't offering a scientific point of view on the test but says without it he wouldn't have been diagnosed as quickly as he was.
"The bottom line for me: I was lucky enough to have a doctor who gave me what they call a 'baseline' PSA test when I was about 46," he wrote.
"I have no history of prostate cancer in my family and I am not in the high-risk group, being neither - to the best of my knowledge - of African or Scandinavian ancestry. I had no symptoms.
"What I had - and I'm healthy today because of it - was a thoughtful internist who felt like I was around the age to start checking my PSA level, and discussed it with me.
"If he had waited, as the American Cancer Society recommends, until I was 50, I would not have known I had a growing tumour until two years after I got treated.
"If he had followed the US Preventive Services Task Force guidelines, I would have never gotten tested at all, and not have known I had cancer until it was way too late to treat successfully."
The actor says the test is criticised because it can lead to unnecessary "over-treatment" but says men should at least be given the option so they stand a chance of early detection.
Get more information about prostate cancer from NHS Choices.