This question already has an answer here:
- Saying Asher Yatzar after Hamapil 2 answers
Say you said hamapil with shema and went to bed and immediately after got the urge to use the bathroom. Can you still say asher yatzar or once you head to bed you don't say asher yatzar until the morning?
I don't have the source but I believe the halacha is that if you wake up in the middle of the night to use the facilities, you do not say asher yatzar until the morning after you wash your hands.