Per Ecclesiastes 7:16, Does the Bible want me to sin? From Ecclesiastes 7:16,


  Do not be overrighteous,
     neither be overwise—
     why destroy yourself? 


So, why does the Bible say, "don't be too righteous"?  Encouraging one to be moderate in their righteousness... Doesn't that seem a bit out of place?
One possible interpretation is that it is warning against legalism - the type of "over righteousness" that the Pharisees were known for.  Not exactly a true righteousness, as seen from God's perspective, but a self perceived righteousness derived from a "holier-than-thou" attitude.

The Werner Bible Commentary puts it like:


  One who is overly righteous or righteous to an excess insists on the letter of the law, failing to take into consideration human limitations and the need for compassion and understanding. Such a person is quick to make a major issue about minor matters, insisting on strict adherence to certain procedures, rules, or practices even when doing so would prevent one from being helpful and kind to those in genuine need.


A bit farther down, in verse 20, it goes on to say:


  Indeed, there is no one on earth who is righteous, no one who does what is right and never sins. Ecclesiastes 7:20 (NIV)


This is something that the Pharisees did not seem grasp, and righteousness through their own "over righteousness" was something that the Pharisees saw as attainable, or already attained.