I will be backpacking the JMT next month and know I need to keep my food, sunscreen, toothpaste etc in the bear container.

However I also read in some other posts that I also need to keep my dirty clothes outside of my tent and backpack and away from the tent at night. and that I should empty my backpack and keep all the flaps open and store it away from the tent site? Is this necessary or overkill. What happens if it rains at night and I have my gear all spread out and not under the rain fly?

I don't keep my clothes outside, that being said if I spilled food on it I would keep my clothes outside. I keep my pack open and under a nice tree for shelter. If it is raining or snowing I keep it under my Hammock or in my tent vestibule.

I have had more damage to my gear from squirrels than from bears. I keep the food in its proper location so every time a bear has come through he just does a quick sniff at my pack and other items and goes on his way. (bear prints in the dirt when I got back from a swim)