夜半 has a literary / classical flavor; everyday speech uses
半夜 (bànyè) — same characters reversed.
夜半 is favored in poetry, fiction, and titles, e.g. Tang poet
张继's 《
枫桥夜泊》: 「
姑苏城外寒山寺,
夜半钟声到客船。」 ("From Cold Mountain Temple beyond Suzhou's walls, the midnight bell reaches the traveler's boat.")