Need help repairing mac partitions

In the Disk Utility app, Click the 'Partition' Toolbar button, then in the big pie chart in the revealed tab, click on the partition you want to erase, then click the minus button ('-') at the bottom of the chart. That partition will be deleted, and the other partition will be expanded to to include the newly-emptied space.

If you're doing this by command-line I think you can use the following (based on the diskutil output shown above):

diskutil mergePartitions JHFS+ "Macintosh HD" disk0s2 disk0s4

The third and fourth terms (JHFS+ "Macintosh HD") are actually dummy terms in this context; they are not used. Assuming that disk0s2 — the main partition — is in an expandable format, this should preserve everything in that partition and overwrite the other two. Per the diskutil man page:

If force is not given, and the first partition has a resizable file system (e.g. JHFS+), the file system will be preserved and grown in a data-preserving manner; your format and name parameters are ignored in this case. [If] the first partition is not resizable, you are prompted if you want to format.