Many times a judge will let an out of control witness go on and on and hang themselves. It is not the judge’s job to stop them, it is the job of the attorney whose witness it is to curb them.
But maintenance of order in the courtroom is ultimately the judge’s responsibility (with some delegated to the clerk and bailiff).