Usage patterns
夜中に〈動詞〉to do something in the middle of the night
I was startled when the phone rang in the middle of the night.
夜中まで〈動詞〉to do something until the middle of the night
I was working until the middle of the night.
夜中の〈数〉時at [number] o'clock in the middle of the night
I woke up at 3 a.m. in the middle of the night.