Why is a gun less accurate when the barrel heats up? I was out target shooting with a friend of mine, and about 2 hours into it I commented how my accuracy seems to be going down the longer we shoot. He (a fire arms instructor in the Navy, so I tend to believe him) said when a barrel heats up, the gun becomes less accurate.
On a side note, he said that when snipers are going for long (~1 mile) long shots. they take out the magazine and leave it in the sun allowing the ammo to heat. They will then load a single bullet at a time because, although a heated barrel will cause a decrease in accuracy, a heated bullet will be more accurate.
Assuming this is true, why would that happen? Is the heated barrel expanding and causing some of the gas to escape around the bullet? And would a heated bullet expand to cause more pressure (more speed/spin?) 
 A: This sounds like two faces of the same coin - expansion due to heating. In the first set-up, the barrel gets hot because of the friction of the bullet and the exploding charge propelling it. The internal barrel diameter will increase slightly due to the excess heat, giving a chance for some of the force of the charge to leak past the bullet, less speed and momentum generally equals less accurate. With a relatively cold barrel and the heated sniper bullet mentioned, the reverse is true - a fractional increase in the bullet diameter will make a slightly tighter fit in the barrel - hence more accurate. Not sure how far to take this, as someone else may know, but if you seriously chilled the barrel, and added a hot bullet, chances might increase of the bullet jamming?
A: I would believe you are correct in thinking of expansion of the barrel. Any slight deviation in the physical properties of the barrel would greatly affect any projectiles exiting it. The expansion would not be equal all around as heat is lost on one side more quickly due to the casing being ejected from the side. 
A: High rates of fire through a rifle barrel can easily heat it to 500C.  That's certainly enough heat to change the barrel's dimensions.  Compounding matters is that the heating is uneven, as is the dissipation.  So you end up warping the barrel in hard-to-control ways, which is enough to affect the point-of-impact.
Very heavy (i.e., thick) barrels are less prone to losing accuracy due to heating because their higher mass absorbs and distributes the heat more evenly, and also because their thickness resists some of the heat deformation that occurs more readily in lightweight barrel contours.
The note about heating the ammunition is completely different matter: Most military small-arms propellants to date have been relatively sensitive to temperature.  They produce their highest pressure (and therefore highest muzzle velocity) when hot.  But here "hot" means something like the 50C you might get from leaving something in the sun, vs. an ambient of 30C or (in cold mountains) something around 0C.  Warming ammunition in the sun or under a coat has nothing to do with trying to increase the diameter of the projectile, but rather wringing the last bit of muzzle velocity out of the round's propellant.
A: Snipers want to be able to predict their conditions. Leaving the ammo in ambient temperature ensures that when making calls for atmospheric conditions that the ammo temperature wont effect the predicted velocity, and thus the drop at said range. one can take into account ammo temp in relation to burn rate of power if they experimented with it at different temps using a laser thermometer and writing down the velocity for in relation to different temps of ammo per different temps of atmosphere. However its a long tedious process and ambient temp and in a job where simplicity matters, its easier to let the ammo soak in ambient temperature to match said DOPE charts. Loading one round at a time allows for the chamber to cool down so heat doesnt transfer to the next round from the chamber...again a matter of burn rate of the powder. 
