Lightening the right hand technique is huge. Almost everyone (myself included!) hits the strings too hard. Especially with flats, I also sometimes get that clank on the E. I've really changed my technique over the last two years to lighten WAYYY up, and it has paid off in so many ways
I've found that slightly adjusting your setup can also help. I like low action, but a P with flats can only be so low. It does need a LITTLE room. I dialed in my P too low (which felt great!) but I got E clank too. Tweaked slightly and it's definitely happier!
Generally (and I mean generally!), if it's buzzing below the 6th or 7th fret, the neck needs more relief. And if it's buzzing above the 6th or 7th fret, you can straighten it out a bit.
Then adjust bridge saddle height accordingly and JAM!