Increasing e-bike battery range by limiting speed
Depends totally on your bike's Battery Management System and what options it offers.

Generally speaking, a battery has a certain amount of stored energy, which is its capacity in watt-hours, which may be expressed in amp-hours (at a known voltage).

Functionally, a battery could put out energy at half the maximum rate, for twice as long.  If your bike's BMS lets you choose a lower level of assist, then it will get you further on a charge.

Excessive speed also costs you in power - at 15 km/h roughly 10% of your power goes into aerodynamic drag, with the bulk as rolling resistance and friction.   At 40 km/h your rolling resistance power loss remains about the same in terms of watts, but the aero losses are now 75-80% of your power usage.    So you're using 5× as much power to cover the same distance, at 3× the speed.   (figures are for a road bike; it's worse for a less aero bike)

If your bike has a throttle and not pedal assistance, then get it up to a safe riding speed and stop using the throttle.  Pedal to keep it at that speed, only use the motor to accelerate or to climb hills.

Remember in the end it's an assistance system, not a replacement for pedalling.  If you're treating it like an electric motorbike, then start pedalling and that will extend your range incredibly.