They are accused of "public indecency" and "inciting immorality among young people", the sources said following Monday's arrests.
Egypt's state security prosecutor has been tasked with investigating Friday's incident at a concert of Lebanese band Mashrou' Leila, according to a judicial source.
On Tuesday, a court sentenced a student, who was arrested separately on Saturday and accused of "debauchery", to six years in jail, a judicial official said.
The official said that under questioning he said he attended Friday's concert, even though this was not linked to the charges against him.
Egyptian law does not expressly ban homosexuality, but gay men have previously been arrested on charges including "debauchery" and "contempt for religion" in the deeply conservative Muslim society.
Signup to our newsletter and follow us on Facebook and Twitter!
In April 2016, a court sentenced 11 men to jail terms of up to 12 years after convicting them of "debauchery and incitement to debauchery", provoking international criticism.
Egyptian police use US-based social networking application Grindr to monitor homosexuals.
Monday's rainbow flag incident has pitted conservatives against advocates of civil liberties in the media and on social networks.
Egypt's conservative musicians syndicate said Mashrou' Leila, whose singer Hamed Sinno is openly homosexual, would not be authorised to perform again in the country.
The group has previously been banned from performing in the Jordanian capital.