This year, practicing Muslims in New York are breaking their daily Ramadan fast with a festive meal about 8:15 p.m. (the time gets earlier as the month progresses). After a few hours of eating, and in some cases visiting Arabic sweet shops, many attend special nighttime services at which the Koran is read, from 10 to 11:30 p.m.

On Tuesday, the late service at the Islamic Center of Bay Ridge attracted hundreds of men, women and children, and a carpet of prayer rugs was laid out on the sidewalk to accommodate the overflow, which stretched nearly to the marquee of a multiplex next door. After the reading, some people stayed for more prayer, some headed home, and some, mostly men, headed out.

At Beit Haniena, a bare-bones Palestinian social club near the mosque, clusters of men played Conquian, a kind of rummy, keeping score on pads (but not betting, because gambling is forbidden in Islam). “To tell you the truth, it’s better off to stay with your family and go home at night, but sometimes we sneak,” said Mashur Abu Hamda, 72. He planned to drink qamar ed-din, a thick, sweet, apricot concoction that is supposed to stave off thirst, before dawn, and to stay up until about 8 a.m.

The Gulf Cafe, run by a Yemeni businessman, had a more tentlike feel. Sofas and heavy curtains lined the dimly lighted purple room, and young men’s faces reflected the glows of their smartphones. Ramadan greetings flashed on a television screen.

Musalam Alkhras, 23, an English-language student from Saudi Arabia, was relaxing with two friends. Back home, he would be with his relatives, but “without family, it is very hard,” he said. At 3 a.m., the three paid their bill and headed to a takeout restaurant for something heavy to eat before the dawn prayer, “like rice with chicken or lamb,” Mr. Alkhras said.

By 3:15 a.m., as some older men drank coffee outside the cafes, a trickle of young teenagers in T-shirts and track pants began to materialize out of the darkness. Jon Kanatarellis, the morning man at Mike’s Donuts across the street from the mosque, was ready for them.