*507Order, Supreme Court, New York County (Karla Moskowitz, J.), entered on or about August 7, 2006, which granted defendant’s motion to dismiss the complaint pursuant to CPLR 3211 (a) (1), (3) and (7), unanimously affirmed, with costs.
The first cause of action was properly dismissed. As the motion court found, the clear meaning of section 4.05 (e) of the stock purchase agreement is that defendant would pay 6.377% of the cash proceeds of the mortgages in accordance with the August 17, 1998 decision of the trial court in the NC Finance litigation. Section 4.05 (e) does not state that if the August 17, 1998 decision is reversed, modified, or vacated, the payments made by defendant prior to such disposition will be recalculated. Courts will not rewrite contracts that have been negotiated between sophisticated, counseled commercial entities such as Mercann and defendant (see e.g. Matter of Wallace v 600 Partners Co., 86 NY2d 543, 548 [1995]).
Given our conclusion that the first cause of action was properly dismissed, as conceded at oral argument, no claim for indemnification lies. Accordingly, the second cause of action also was properly dismissed.
Plaintiff Flag Wharf may not pursue claims under the stock purchase agreement, however, because it is neither a party to the contract (see Sone v Tsumura, 222 AD2d 231, 232 [1995]) nor a third-party beneficiary thereof (see section 12.08 of the stock purchase agreement). Its claim for unjust enrichment was thus properly dismissed. “The doctrine of unjust enrichment ‘rests upon the equitable principle that a person shall not be allowed to enrich himself at the expense of another’ ” (Mackie v La Salle Indus., 92 AD2d 821, 822 [1983] [emphasis added], appeal dismissed 60 NY2d 612 [1983]). As shown by the settlement documents in the record, Flag Wharf did not pay anything extra to obtain defendant’s release in the NC Finance litigation. Concur—Friedman, J.P., Sullivan, Sweeny, Catterson and McGuire, JJ.