If it's a wireless unit, replace it. Or at least try new batteries first.
If it's hardwired, trace the wires. Either in the attic or under the house. See if the wire is good. You're looking for evidence of mice or squirrels eating into the sheath..... yeah, they find that stuff tasty. Also look at the connecting points at the transformer and the junctions (if any) and at the door bell switches. Be sure the insulation on the wires is not falling off exposing too much copper. Sometimes, there is damage to the button and the tolerances are really close and that's all it takes.... the heating and cooling between day and night can make a difference.
Replace any damaged or questionable wire.
Since the unit has some microprocessor stuff in it to let you play various tunes, I would first of all suspect that the processor has some damage perhaps from a lightning strike in the past. The test would be to replace it with a simple chime unit that you can buy for a few bucks at a Home Depot or Lowes. See if that solves the issue with the 3am door chimes. If it does, buy a new chime unit.... if not.... look deeper into the wiring.
The doorbell is a simple circuit. Power source, wire to the doors, a switch at the door, and a load/chime. That's it.
To ring the bells, you complete the circuit at the door with the switch. Anything else doing the same along the wire from the transformer to the switch will also ring the bell.
The other possibility is that there is a spirit that has taken up residence with you..... but I don't believe in that sort of thing....well I do actually, but just not in ghosts..... Although I don't think that's likely what you have going on here.