Non-negligible uncertainties of the calculated proton range due to e.g. conversion of computed tomography data into stopping power ratio, patient positioning, and anatomical changes, limit the considerable advantages of proton beams in radiation therapy. Prompt gamma imaging (PG) can enable in-vivo monitoring of the proton range, but its accuracy and precision are affected by both tissue heterogeneities and counting statistics. These effects are not considered in current treatment planning systems (TPS) and intensities of most pencil beams are not optimized with respect to the precision of PG range monitoring. In our research, we investigate the possibility of re-optimizing TPS accounting for in-vivo proton range monitoring.