Properly determining the driving range is critical for accurately predicting the sales and social benefits of battery electric vehicles (BEVs). This study proposes a framework for optimizing the driving range by minimizing the sum of battery price, electricity cost, and range limitation cost referred to as the "range-related cost" as a measurement of range anxiety. The objective function is linked to policy-relevant parameters, including battery cost and price markup, battery utilization, charging infrastructure availability, vehicle efficiency, electricity and gasoline prices, household vehicle ownership, daily driving patterns, discount rate, and perceived vehicle lifetime. Qualitative discussion of the framework and its empirical application to a sample (N=36664) representing new car drivers in the United States is included. The quantitative results strongly suggest that ranges of less than 100 miles are likely to be more popular in the BEV market for a long period of time. The average optimal range among U.S. drivers is found to be largely inelastic. Still, battery cost reduction significantly drives BEV demand toward longer ranges, whereas improvement in the charging infrastructure is found to significantly drive BEV demand toward shorter ranges. In conclusion, the bias of a single-range assumption and the effects of range optimization and diversification in reducing such biases are both found to be significant.