This work proposes a new resource allocation optimization framework for cellular networks using fog or neighborhood-based optimization rather than fully centralized or fully decentralized methods. In neighborhood-based optimization resources are allocated within virtual cells encompassing several base-stations and the users within their coverage area. As the number of base-stations within a virtual cell increases, the framework reverts to centralized optimization, and as this number decreases it reverts to decentralized optimization. We address two tasks that must be carried out in the fog optimization framework: forming the virtual cells and allocating the communication resources in each virtual cell effectively. We propose hierarchical clustering for the formation of the virtual cells given a particular number of such cells. Once the virtual cells are formed, we consider several optimization methods to solve the NP-hard joint channel access and power allocation problem within each virtual cell in order to maximize the sum rate of the entire system. We present numerical results for the system sum rate of each scheme under hierarchical clustering. Our results indicate that proper design of the fog optimization results in little degradation relative to centralized optimization even for a relatively large number of virtual cells. However, improper design leads to a significant decrease in sum rate relative to centralized optimization.