This question got me thinking about the Muggles who know about the magical world. We know there is the statute of Magical Secrecy, but we also know that it isn't always necessarily obeyed and there would surely be circumstances in which it would need to be broken for the greater good. Also, in the case of the Prime Minister, they aren't in their role forever so when they leave office, that's another Muggle who knows about the Magical World that no longer has a need to. My question is, similar to the Men in Black Organisation, is there a department in the Ministry of Magic which erases relevant memories from muggles who have come to know about the magical world?
There is indeed a select group of Ministry employees whose job it is to erase Muggles' memories after they witness magical events. They are called Obliviators, after the Memory Charm's "Obliviate" incantation.
They don't have their own "department." Instead, Obliviators are part of the larger Department of Magical Accidents and Catastrophes:
"Level Three, Department of Magical Accidents and Catastrophes, incorporating the Accidental Magic Reversal Squad, Obliviator Headquarters and Muggle-Worthy Excuse Committee." (OOTP)