The soap opera-themed episode is to air in March, the network said.
"In the episode, entitled 'One Life to Lose,' a murder has been committed on the set of 'Temptation Lane,' one of New York's longest running soap operas," ABC said in a news release. "Sarah Cutler, the head writer on the soap, has been killed with a fire axe. Castle and Beckett quickly discover that the behind-the-scenes drama at 'Temptation Lane' is just as scandalous as the fictitious story lines, and just about everyone would kill to get ahead. Ultimately, Castle's unique skill set as a writer leads to a discovery about the killer and the secret he or she would do anything to protect."
Nathan Fillion, who plays writer Richard Castle on "Castle," acted on the daytime series "One Life to Live" as Joey Buchanan from 1994-1997 and on two episodes in 2007.
Stana Katic plays NYPD Detective Kate Beckett on "Castle."
Wisconsin business offering 'therapeutic cuddling' forced to close
N.J. man wakes up from 10-hour sleep with knife in back