Rebooting or Resetting an iPhone (3, 3GS or 4) requires only one step but isn't really obvious.
All you need to do is hold down
both the button on the top right
at the same time as holding down the menu button
(the button with the square on it, on the front of the phone). Highlighted below:
Keep both buttons pressed for several seconds and you may be prompted to turn off the phone, ignore this message and keep both buttons held down, after a few more seconds your iPhone will reboot.
Nothing will be lost that is saved on the phone but running applications may need to be restarted (in the case of iOS4).