It is the role of the judge to remain impartial in your criminal case. This means the judge will treat both sides equal, fair, and, just. But, depending on what stage your case is at, maybe a jury trial, bench trial, or punishment hearing, the judge may have more room to ask some questions that could sound as if he or she is acting on behalf of the prosecution.
What can happen if the judge goes beyond allowed questioning of a witness?
There is a point where the judge can ask questions that affect his or her impartiality and abandon their neutral position. In the Texas 5th District Court of Appeals case, White v. State, the court explains that there are two dangers of a judge going beyond allowed questioning: (1) it may seem that by his or her questioning, the judge is communicating his opinion of the case to the jury and could persuade the jury to think the same and (2) the judge may lose his impartiality and start to support one side than the other.