Actually, having just finished Heat Rising, I'm now certain the actual writers are series creator/showrunner Andrew W. Marlowe and Tom Straw, a mystery writer who was mentioned on the cover of the first book and has often been suspected of being the writer. In the acknowledgments (which are supposedly written by Castle but are an opportunity for the real writers to express their thanks), there's a paragraph thanking both Andrew W. Marlowe and "Tom," in such glowing terms that I think it must be the respective writers thanking each other. Also, there's a mention in the acknowledgments of Marlowe's wife (a fellow writer on the show) as someone who's "always beside me." Moreover, just from reading the book, I realized that the Jameson Rook character (the surrogate for Castle) talked exactly like Castle, complete with an almost audible Nathan Fillion influence. It would be difficult for anyone other than the showrunner, the person who does the final polish on all the scripts and shapes the characters' voices (and works routinely with the actors), to capture that voice so exactly. So I was convinced it was Marlowe even before I read the acknowledgments.
Nathan Fillion was on the Kevin Pollock's Chat Show podcast last year and he mentioned that the actual writer of the book was in one scene, talking to Castle, in a bookstore prior to one of Castle's autograph sessions. If I remember correctly, the scene shifted to Castle wrapping up the conversation, and he said to the guy something like "sounds good, thanks" and the guy walked away.
Kevin asked him who the writer was, and Fillion declined to say since it was Castle who wrote the book.