Context. Two millisecond pulsars, PSR J1513−2550 and PSR J2017−1614, with spin periods of about 2.1 and 2.3 ms were recently discovered in the radio and γ-rays and classified as black widow pulsars in tight binary stellar systems with orbital periods of about 4.3 and 2.3 h. Aims. Our goals are to reveal the fundamental parameters of both systems and their binary components using multi-wavelength observations. Methods. We carried out the first time-series multi-band optical photometry of the objects with the 2.1-m telescope of the Observatorio Astronómico Nacional San Pedro Mártir, the 6.5-m Magellan-1 telescope, and the 10.4-m Gran Telescopio Canarias. To derive the parameters of both systems, we fitted the obtained light curves with a model assuming heating of the companion by the pulsar. We also analysed archival X-ray data obtained with the XMM-Newton observatory. Results. For the first time, we firmly identified J1513−2550 in the optical and both pulsars in X-rays. The optical light curves of both systems have a single peak per orbital period with a peak-to-peak amplitude of ≳2 magnitudes. The J2017−1614 light curves are symmetric, while J1513−2550 demonstrates strong asymmetry whose nature remains unclear. Conclusions. We constrained the orbital inclinations, pulsar masses, companion temperatures and masses, and the distances to both systems. We also conclude that J2017−1614 may contain a massive neutron star of 2.4 ± 0.6 M⊙. The X-ray spectra of both sources can be fitted by power laws with parameters typical of black widow systems.