Gay sex is outlawed in Aceh, which imposes a version of sharia, the Islamic legal code, but it is not illegal elsewhere in the world's most populous Muslim majority country.
The men were part of a group of 10 who were flogged Tuesday at a park in the provincial capital, Banda Aceh for a range of alleged crimes.
The pair were flogged separately with a rattan stick as a small crowd watched, according to an AFP journalist present.
Their initial sentences of 80 lashes each were reduced by four for four months spent in detention.
In April local sharia police found the two men together at a public toilet in the same park where they were later flogged, said Roslina A. Djalil, head of Banda Aceh sharia police's law enforcement.
"A member of the public saw suspicious people and reported it," Roslina said.
Three women and five men were also flogged Tuesday after being found guilty of sex outside marriage, being in close proximity to members of the opposite sex, and online gambling.
Caning retains strong support among Aceh's population as a common punishment for offenses including drinking alcohol and adultery.
The region started using religious law after it was granted special autonomy in 2001 as Jakarta tried to quell a long-running separatist insurgency.