AbstractSuperblocks are city blocks whose size is significantly larger than average for a city block. They are considered to be close if they only have a few gates connecting the pedestrian and car traffic inside with that outside of the block. The gate setting of superblocks, namely the number and location of gates, despite playing a very important role in the overall traffic performance, has attracted limited attention in research. This paper narrows this gap by proposing a bilevel optimization model to calculate the optimal gate setting for superblocks. The lower-level model involves the traffic assignment, paying attention to travelers’ mode and route choice behavior. The upper-level model computes the optimal number and location of gates to minimize the total cost, considering both travelers’ cost and infrastructure cost. To solve this model efficiently, we also develop a solution algorithm, whose output is the optimized gate setting. A case study is used to illustrate the impact of the gate-setting problem on the performance of the transportation network, and the applicability of the proposed algorithm. Results indicate that the number and location of gates significantly impact traffic performance. For example, it is possible to have a lower cost with three gates that are well located than with nine gates that are poorly located. Furthermore, for the specific network studied, the optimal gate setting solution reduces the total cost by 17% and leads to a 3% mode shift from private car to metro when compared with the existing conditions.