How to delete partition disk0s4?

Two things come to mind - booting from recovery HD might let Disk Utility be more free in changing the filesystem where your OS resides. You could also try removing it using diskutil in terminal:

diskutil unmount disk0s4
diskutil mergePartitions ignored ignored disk0s2 disk0s4

You will want to have a backup or be familiar with command line and also verify that your Macintosh HD is really disk0s2 by reviewing diskutil list before making any changes.

Once the disk0s4 is subsumed by Macintosh HD you may need to expand that to fill the drive:

diskutil resizeVolume disk0s2 R

If done properly on a system with no issues, all the above commands are non-destructive to disk0s2 (presumably Macintosh HD) and the boot volume support. You will need to go in and set your startup disk to the resized volume using System Preferences to avoid a long delay each time you start your Mac as it looks for the old location of disk0s2 from which to boot. The bless command would work to set the boot destination as well.