Detecting cancerous lesion is a major clinical application in emission tomography. In a previous work, we have shown that penalized maximum likelihood image reconstruction can improve lesion detection at a fixed location by designing a shift-invariant quadratic penalty function. Here we extend this work to detection of tumors at unknown positions. We present a method to design a shift-variant quadratic penalty function that maximizes the detectability of lesions at all possible locations. We conducted computer-based Monte Carlo simulations to compare the optimized shift-variant penalty with the conventional penalty for detecting a breast lesion. Lesion detectability was assessed by a channelized Hotelling observer and human observer. The results showed a statistically significant improvement in lesion detection by using the optimized shift-variant penalty function compared to using the conventional penalty function.