Hold both Home and Power buttons for about 3-5 seconds, right when the iPhone turns OFF release the buttons. If it still restarts then you may have a short in the iPhone Charging Port causing the iPhone to turn on. Clean the Charging Port with a clean dry toothbrush, to get all the dust, lint, and debris out.
If Apple Store says you have water damage and can't help you. Then clean the port with a bit of Isopropyll Alcohol on the toothbrush, clean especially the dock pins which are on top of the midrib.