Bathroom and hallway lights keep turning off
If I had this problem the first thing I would do is to check to see if the switches in this application are wired with back stab connections. This type of connection can become unreliable and intermittent. They can be sensitive to vibrations, temperature and even current flow through the wires. Here is what back stab connections look like:



Picture Source

If you have connections like that you should take steps to replace the switches with new ones that have the wires properly installed under the screw terminals like this:



Picture Source

Several things to note:


There are some types of switches that have screw tightened clamp terminals for the wires. With these the wires enter from the back and then the screw is tightened to secure the wire. These are fine to use as well.
The switches shown in the pictures do not show ground wires connected. Your new switches will most likely also have a green screw for a safety ground connection and you should also provide for this.
When working with the switches and open electrical boxes make sure to turn off the circuit breaker that feeds power to this lighting circuit. 
Double check any wires for power present with a non-contact electrical tester to make sure that wiring is deenergized before touching or working with connections.
If you feel at all uncomfortable with doing DIY electrical work then do make an appointment with a professional electrician to come do the work for you.