Dynamic range is one of the primary limitations that restricts digital image sensors from acquiring more visual information. Current high dynamic range (HDR) imaging techniques entail a trade-off between dynamic range and visual fidelity. In this work, we propose a HDR imaging method, termed PE-HDR, to achieve both a wide dynamic range and high visual fidelity without additional complex post-processing algorithms. Instead of merging a bracketed exposure sequence, the PE-HDR captures HDR images in a single shot using optical coded pixel-wise exposure control, enabling cost-effective and flexible HDR imaging. By incorporating a differentiable optical encoder and a neural network decoder, we jointly optimize the imaging pipeline from light irradiance to digital image signals, thereby refining the pixel-wise exposure control strategy and improving image fidelity. Both simulations and experiments demonstrate that the proposed method achieves a dynamic range of up to 120 dB and an excellent visual fidelity with spatial resolution of up to 2560 × 1600 pixels.