In his guide to productive academic writing, How to Write a Lot, psychologist Paul J. Silvia recommends that you perceive and organize your writing as a job:
- set aside regular and fixed periods of time for your writing
- do not let anything come between you and writing: neither "not feeling like it" nor a bored spouse must keep you from getting to work on your writing, just as these wouldn't count as valid reasons to stay home from your day job
Through research and experience Silvia found that successful writers make a habit of writing. They adhere to strict schedules.
For Silvia, from the writing-as-job perspective, everything that you need to do to actually put words on paper counts as "writing", including planning and research.
Again, this is similar to any other job. A secretary is not expected to buy photocopying paper in her leisure time. Of course there are limits to what counts as work, and you must not use this perspective as an excuse to avoid actually sitting down and typing.
To get a better idea of how much time you should actually spend writing in the more narrow sense of the word, observe what goes on when you write.
At first you will need to "get into it": there will be a half hour or so that you re-read what you wrote the previous day, make corrections, or "warm up" with some writing exercise. Or you try to write, but it takes some time for your ideas to start, and at the beginning you write and delete a lot, before you get into the flow. No matter how you "get into it", these seemingly unproductive first minutes are necessary and you should observe yourself and note how long this period usually takes.
Then there will be a long stretch of time during which you write more or less effortlessly. You fill page after page, only taking short breaks to drink or eat or visit the toilet. (Turn off the phone and don't check email!)
But after some hours of this, you will notice that your ideas peter out. You make more mistakes, have to correct more often, have a harder time to find the right words. Your thoughts begin to stray, and you feel the urge to check your email or make phone calls. Note when this begins.
If you find it difficult to note this moment while you're in it, re-read what you wrote the next day. You'll notice that at some point the quality of your writing deteriorates and you have to re-write it more. If you save different versions of your text (e.g. by appending version numbers to your file or by using a version tracking software) you can look at the creation date of that file to identify that moment. That is the maximum time you should spend writing on any day.
At the same time, this, plus the warm up time, is the minimum time you should, if your day job and family life allow, give yourself to actually write (in the narrow sense). All your research and planning should take place outside of this core writing time, if possible. Then you will work at your most productive.
How long this core writing time is will vary with training (after a year of writing you'll be able to write longer) and with where you are in your novel (there may be no writing in the planning stage of your novel, and almost no planning in the writing stage).
How you balance writing and research will largely depend on how you write. David, in his answer, explained that he researches parallel to his writing. I prefer to take a few weeks or months and dedicate them completely to research and outlining the story, and when I write I have everything in my head (or folders) and do nothing but write for another few weeks or months.
This is a technique I learned from academic writing, where you have to complete your research and conduct your experiment before you know the results that you can then write about. While I research, I work on my characters and plot and create a detailed outline. When this is finished, my research is also finished, and I take that skeleton structure and flesh it out.
Silvia's book is my favourite book on writing and I recommend it wholeheartedly. That it is about academic writing does not matter, because while some part of the book is dedicated to that the first half or so is dedicated to writing productively in any genre by addressing such questions as writer's block (which does not exist, according to Silvia, but is simply a lack of habit).