Various localities have ordinances relating to noise and parties. However, there is generally no authority on the part of the police to "shut down" a party. Their basic authority is to arrest people for disturbing the peace by making too much noice or finding them outside and arresting them for drunk in public.
Sometimes the police are doing everyone a favor if it is late and people are just gong to get in more trouble. Sometimes they are just badge heavy and are asserting their power. And sometimes they put out a radio call so that their fellow officers can wait down the block and arrest people for drunk driving or drunk in public as they leave.
However, it is best not to argue with the officers since they have the badges and the guns. Certainly do not disobey an order if there is even a chance that it is lawful. Instead, you can follow up the next day with a complaint to the department and ask that they do an internal affairs investigation. This may or may not work but having a complaint in the officers file may prompt them to act the next time.
If you have a more specific issue or want to take any action, call a lawyer. We cannot give specific legal advice in this forum. Good luck!