The answer is yes.
The judge has the discretion to control the courtroom and the trial. If he feels the need to interrupt you and continue questioning the witness, he can do that.
An awkward situation arises when the judge begins to ask questions that may not be entirely appropriate. In that instance, the attorney must object and interrupt the judge.
So here is the scenario: the judge feels that the correct questions are not being asked. He feels that you're not asking the right information. He interrupts and then begins to question the witness himself.
How long can this continue?
Typically until the judge is satisfied with the answers.
What if the attorney did not want the witness to discuss what the judge is asking?
Once again, the attorney must stand up and object. Since the judge has decided he needed to intervene and ask clarifying questions he will usually say "Objection overruled." This means that the judge will continue questioning the witness himself.