Unfortunately, it's not that easy. As mentioned above, an attorney can't withdraw in the middle of litigation without the judge's permission, and it's indisputably unethical for an advocate to directly inform the judge that his client is a liar. What usually happens in these cases is that the lawyer approaches the bench and asks to beg off the case for vague "ethical reasons." The judge, knowing exactly what's going on, typically denies the request, because the jury would smell a rat if the lawyer were to disappear right before the defendant took the stand. The judge, continuing the Kabuki-style exchange, informs the advocate that he has satisfied his ethical obligations and must continue. In some courts, the lawyer can protect his sense of ethics by simply putting the client on the stand and instructing him to "tell the jury his story," rather than specifically prompting the lies.
Slate looks at various reasons why a lawyer can and should quit a case -or not. Link