Most scholars agree that Shakespeare's primary source for Measure for Measure is George Whetstone's 1578 play Promos and Cassandra.
The title of the play is taken from Christ's Sermon on the Mount, specifically the version offered in the Gospel of Matthew: "Judge not, that ye be not judged...with what measure ye mete, it shall be measured to you again" (King James Version). There are several other references to Scripture, particularly Job and Ecclesiastes, but primarily the references come from the Gospel of Matthew.
Other "problem plays" from Shakespeare, which critics have trouble defining as either comedy or tragedy, are All's Well That Ends Well, Troilus and Cressida, The...