The incident took place yesterday, they said, adding that the accused are of the same age group and sodomised the boy when they went out to play with him at Gageru village in Shamli district.
The two boys are being questioned, they said.
In an another incident, a woman has filed a case of sodomy against her husband in Shamli town, police said.
The woman has also registered a case of dowry harassment against five members of her in-laws' family, including husband Niraj Kumar yesterday.