It depends on what works for you. I've read in numerous places that setting a time for yourself to sit and write is a great way to stay consistent and make sure your creativity jump starts at around the same time every day. BUT, I've also known people who work better at sporadic times, just like some people work better in silence while others work better with music playing in the background.
As far as how much time to allot, this is where a freelancer's bag of tricks comes in handy. The trick that I love and that helps me a lot is the 50-minute block of straight work. You sit down and work for 50 minutes and then take a 10-minute break.
Some authors will finish a book in a year... others in a week. These authors may or may not have a scheduled time to write, but they've certainly figured out what works for them in order to produce the best work humanly possible.