Under Islamic law in practice since the 1979 revolution, "hijab" -- which requires women to cover their hair and much of their body in loose clothing to prevent their figures being seen -- is obligatory.
"Some 4,000 demonstrators urged the authorities and people to take heed of the situation of hijab and chastity in the society," the official IRNA news agency said of the demonstration, which took place outside the interior ministry.
Pictures of the gathering showed both male and female protesters.
"Preserving public chastity, observing Islamic hijab and moral security are strategic matters which shall not be forgotten under the pretext of economic sanctions or government change... There are some people who are completely heedless of the Islamic hijab," read a statement issued by demonstrators.
Fars news agency reported that "the demonstration didn't last long after Tehran police chief Hossein Sajedinia appeared at the rally and pleaded for it to end."
Signup to our newsletter and follow us on Facebook and Twitter!
Hossein Hashemi, governor of Tehran province, said the demonstration was not legal since no permission was granted by the interior ministry.
"One who seeks to prevent vice should not commit such a violation (of law)," he told ISNA news agency.
Iran's police force includes a "morality" unit tasked with checking women in the street to ensure their clothing follows the rules. Arrest and overnight detention is common.
President Hassan Rouhani, a self-declared moderate, asked Iran's police in October to be lenient on the hijab issue.
The soft-spoken president, who has the backing of reformists, moderates and some conservatives, campaigned for more cultural and social freedoms in the Islamic republic en route to winning last summer's election.