Remove the trim panel over the HUD and remove the HUD itself.
Remove the 4 T15 screws holding the HUD together at the four corners
Looking inside we see the circuit board, remove the two wire brown connector from the board
Remove the ribbon cable from the board
Gently pull back the two tabs being pointed to by the pens and lift that side of the circuit board.
Now with your circuit board out, find the photocell. It is the round sliver item with a glass on it.
Find the two solder dots holding the photocell to the circuit board on the other side.
Using a soldering iron (smallish tip) touch each of the two soldering points for the photocell to reflow the solder on them. Reflowing is heating them up to allow the solder to liquify again and make a good connection.
Reassemble. If the issue was a loose photocell, your problem should now be solved.