The answer to this question should be obvious—"As long as I enjoy what I'm doing and am growing professionally." If you have a work history of changing jobs frequently, you may need to deal with that issue up front. For example, if the interviewer notices that on average you change jobs every two to three years, he's probably trying to get some indication if you plan to repeat this job-hopping pattern. Anticipating this potential objection to hiring you, you might respond as follows:
I'm really looking for a long-term commitment with a company where I can fully utilize my skills and grow professionally
In the past, most of my jobs were entry-level positions with small companies that did not offer many opportunities after a year or two. I've purposefully decided not to pursue opportunities with such companies again.
If you are indeed a job hopper who gets restless after a year or two on the job, you need to deal with this issue in a different manner. Ideally, you recognize this is a problem and you've made the necessary adjustments so that you've hopefully broken the pattern:
My previous jobs where not good fits because I was uncertain what I really wanted to do with my life. I often took jobs that looked interesting but in reality were not compatible with my motivations and skills. I've had a long talk with myself; as well as a career counselor, which helped me better focus on what I really should be doing given my interests, skills, accomplishments, and goals. I see this job as a perfect fit for what I really want to do for at least the next five years.