He was taken to a local hospital, where he died.
Police say Castillo wouldn't drop a gun he was holding.
In addition to the murders, Castillo was also wanted for kidnapping his 5-year-old son. Police suspect Castillo shot his ex-girlfriend Heather Courtney Sorensen, 31, and her boyfriend Stephen Rene Serna in front of the boy on Wednesday morning, then fled with the boy.
The boy was dropped off at a relative's house a few hours later. The 5-year-old is safe in protective custody.
Castillo's uncle, Bobby Flores, had pleaded with the 31-year-old on Wednesday to turn himself in.
"A lot of our lives are going to be changed because of what you did, the decision that you made out of anger," Flores said.
Castillo's family says he grew up around violence. At 16, he started serving nine years in prison for murder.
"He had murdered a young boy and it was because the young boy had been bullying him," Flores said.