It was shown recently that CSMA (Carrier Sense Multiple Access)-like distributed algorithms can achieve the maximal throughput in wireless networks (and task processing networks) under certain assumptions. One key assumption is that the sensing time is negligible, so that there is no collision. In this paper, we remove this idealized assumption by studying CSMA-based scheduling algorithms with collisions. First, we provide a model and give an explicit throughput formula which takes into account the cost of contention resolution. The formula has a simple form due to the quasi-reversibility structure of the model. Second, we show that the algorithms in [Allerton'08] can be extended to approach throughput optimality in this case. Finally, sufficient conditions are given to ensure the convergence and stability of the proposed algorithms.