It becomes clear that Tartuffe, as he becomes increasingly powerful in the play, considers himself above the others, and because of his "spirituality," he is above the laws of God, too. He tells Elmire, Orgon's wife, "I'll teach you, Ma'am, that Heaven's contradictions, give latitude to men of pure convictions. it's true that Heaven frowns on some dark acts, though with great men, our Lord makes higher pacts" (Moliere, Act IV, Scene 5). He tells her this as he is attempting to seduce her, so it is clear that Tartuffe thinks he is above everything, including sin, and that he has a "special" pact with God that allows him to pretty much do as he pleases. This is another jab at religion, which often takes itself too seriously, and so do some members of organized religions, and this is who Moliere is parodying in the play.
In the end, Orgon discovers Tartuffe attempting to seduce his wife, and then he learns, in a complex part of the plot, that Tartuffe has obtained ownership of Orgon's house, and he is going to force the family to leave, leaving them in financial and personal ruin. Tartuffe has denounced Orgon to the king, and Orgon is devastated. The man he trusted and gave so much to has betrayed him, and has shown himself to be nothing more than an evil manipulator. When it seems as if nothing can intervene, the police arrest Tartuffe and restore the home to Orgon and his family. The king, who is pure and good, saw the evil in Tartuffe's heart and knows that he has committed crimes in the past.
Moliere wrote this play for the king, and so gave him the best qualities in the play, which are directly opposite of Orgon's qualities. Orgon is not wise enough to see through Tartuffe, but the king is, and that is the only thing that saves the family. Tartuffe will not be able to hurt anyone else, Orgon's daughter can marry the man she loves, and everything will turn out all right in the end. Again, the most pious and fanatical character in the play, Tartuffe, turns out to be the villain in the play, and that is Moliere's commentary on religion. It is better to be wise and trust your heart than trust the exclamations of others, especially when they claim to be so spiritual, seems to be this play's central message. So, it was not critical of religion, as such, it was critical of the zealots and fanatics, and of those who put too much faith into religion without questioning the ulterior motives of the overly faithful.
Moliere created the play as a comedy because the situation is absurd, and so are some of the characters. Making the play a comedy makes it easier for him to poke fun at religion and religious beliefs, because it is seen as being amusing and entertaining, at the same time. He writes with a knowledge of people and their weaknesses, and critic Crawford notes this. He writes, "Moliere has simply observed his fellow man and has probed deeply into his idiosyncrasies. But his probing is always in the comic spirit, and exaggeration of character, one of the main controls in comedy of humors, is fully employed for the evocation of laughter" (Crawford). Moliere could have made this a serious drama, but it would not have been the same, and it might have been even more offensive to theatergoers of the time.
In conclusion, "Tartuffe" sheds light on the way people react to religion and religious fanaticism, and shows that some people will use religion for their own gains, preying on the weak and the overly pious. Simply boasting about one's religious faith does not make it so, and by making Tartuffe a liar, evil, and a hypocrite, Moliere is really saying that religion can be just as bad as anything else if it is used in the wrong hands. He just does that in a very clever way with this play.
Crawford, Jerry L. "Tartuffe: Attacking Hypocrisy, Not Religion." Utah Shakespeare Festival. 2007. 4 Nov. 2008. http://www.bard.org/education/resources/other/tartuffeattacking.html