Merry possibly just knew it was time to get up. My grandfather never used an alarm clock and always got up at 5.30am; I used to have the same ability when I was a kid but nowadays it takes a clock radio with the volume set to an ear-splitting level to get me out of bed which may be due in no small way to having to go to work instead of lovely school.

But I do not have a watch and tend to know roughly what time it is without looking at a clock.
But, how did they know it was 4am if it was dark and they didn't have a clock anyway? How would anyone know the time in the middle of the night in Middle-earth unless there was someone posted to the job of counting it?