“How can you guarantee that you won't change/quit the job after just a couple of months?” How to respond to this question in an interview?

As additional reinforcements, you can say that after some pursuits, the current priority in your life is stability and your hunch is that this company would be providing it to you.

Such questions do not serve any purpose other than the companies observing the body-language (if face-to-face interview) or the time taken for the response (if over phone). Nobody can assure anything in the future.

So, my first suggestion is: be sincere. I am assuming that you do not plan to use the opportunity purely as a back-up. Then here are my suggestions to handle the situation - mainly to convince them. But if your interest is to cheat the company, please, please, do not follow my suggestions.

So, do not show any eagerness. Don’t start saying, ‘Sir, I swear I will not do so’ etc. You may say, that based on the job specs and the quality of interactions you are convinced of a long stay in the company. You can casually point out that you are assuming that the feeling should be, of course, mutual.