In order to succeed in this position, you should be able to engage both the rich, the educated and the pious, as well as the poor, the ignorant and the immoral.
In that syntax, you would use "both," not because it refers to more than two things but because it refers to exactly two things: one, the rich, the uneducated, and the pious and, two, the poor, the ignorant, and the immoral. "Both" refers to those two lists. The fact that they are each lists of three is immaterial because "both" isn't referring to their internal itemization but simply to their aggregation into two items, for example:
John, Bob, and Mary; Susan, Hank, and Gretchen; and Steven, Alice, and Tom make up the first, second, and third place teams, respectively.
Therefore, you can say:
Both John, Bob, and Mary and Susan, Hank, and Gretchen earned medals, coming in first and second place, respectively.
Where it gets confusing, albeit still grammatical, is when we say something like:
Both Romeo and Juliet and Jack and Jill are coming to our dinner party tonight.
Because we know that Romeo and Juliet are a couple and that Jack and Jill are another couple, we can infer that "both" is referring to "Romeo and Juliet" as an item and to "Jack and Jill" as an item, making two items. If you don't know that however, it becomes harder to infer.
What you wouldn't do is put a comma before "as well." What follows "as well" isn't incidental to the sentence. It's not parenthetical. By saying "both," you clearly intend to say two things: one, the rich, the uneducated, and the pious and, two, the poor, the ignorant, and the immoral. As the word "both" makes the second item integral to the sentence, you cannot separate it from the list of two items by a comma any more than you could say, "Jane, and Bob, are here," or, "Jane, and Bob are here."