Science fiction, fantasy, and horror are playmates in the genre sandbox, but there are clear lines that divide and define the genres, right? Spaceships=Science fiction. Magic=Fantasy. Ghosts=Horror.
How would you define Ray Bradbury? Was he a science fiction writer? A horror writer? Many of his stories blur the genre lines. There Will Come Soft Rains is the story of an automated house going about its usual tasks of cooking and cleaning. After a time, it becomes clear that humankind has been destroyed by nuclear war. At face value, it’s science fiction. Except for the burned-out images of the family on the side of the house; except for the dog that returns to the house to die; except for the house itself unable to prevent its own destruction when fire breaks out.
The story has always felt like horror to me. Science fiction flavored horror, sure. Much like the movie Alien which is basically a haunted house story, with a xenomorph and a ship instead of a ghost and rotting rafters.
I think writers often limit themselves genre-wise. They define themselves (or are defined) with a genre label and then write only things that will fit within that box. Maybe you’ve written ten science fiction stories and call yourself a science fiction writer, but what happens when you have a great idea about a magician? Are you going to decide not to write it because it isn’t science fiction? If you choose that path, I ask why?
Sometimes exploring another genre will open you up to new storytelling methods or new ways to twist the familiar into something else. And you don’t have to follow clear cut genre definitions; the Genre Police will not come and slap on the cuffs if you add a pinch of magic to your horror or a bit of horror in your science fiction.
If you feel your career will be best served by keeping your published work in the same genre, you are still not bound by a set of invisible rules when it comes to writing. Sometimes you just need to write for yourself. Warm up the word machine with tidbits of an epic fantasy or science fiction or horror. Indulge in a literary vignette.
If Stephen King had decided to write only horror, there would be no The Shawshank Redemption, no The Body (filmed as Stand by Me). If Justin Cronin had decided to remain a literary writer, there would be no The Passage. Same with Colson Whitehead and Zone One.
Write the stories that are in you. Let other people decide the genre.
A final caveat: My debut novel, Ink, was released last year from Samhain Horror, but if you ask me if I’m a horror writer, I’ll probably answer, “I’m not sure.” Most of what I write is dark, but is it all horror? I’m content to let others decide.
Sometimes the genre-crossing/busting novels are the most fun, for that very reason. Most recent example I've come across: Captain Vorpatril's Alliance by Lois McMaster Bujold is both science fiction and a Georgette Heyer homage–essentially a Regency romance in space. And it works great on both levels.