The resignation of civil judge Muhammad Masood Bilal of Khanewal district in Punjab province had been accepted, said Lahore High Court Registrar Sohail Nasir.
The High Court had initiated departmental proceedings against Bilal even before he resigned, Nasir told reporters.
Bilal attended a party to celebrate the engagement of his brother and danced with a "professional dancing girl", officials said on condition of anonymity.
A video of the dance was uploaded on YouTube on July 20.
The Lahore High Court took notice of the video and initiated departmental proceedings against Bilal, officials said.