Sell to close is an order to sell option contracts that the trader already owns, ending a long position. A holder of a call or put option uses it to take a profit or cut a loss before expiry instead of exercising the option or letting it lapse. The seller receives the current option premium, which includes any remaining time value.
It is one of four order labels that brokers use to show whether a trade starts or ends a position. Buy to open and sell to open are each an opening transaction that creates a new long or short position; buy to close and sell to close are each a closing transaction. The label matters for margin and for open interest: when both sides of a trade are closing, open interest falls. Selling to open by mistake would create a new short position.