Problem controlling speed with a 4 transistor h-bridge

Hello,
I am trying to control a 20v dc motor with 4 transistor (2 pnp bd238, 2 npn bd237).
I am supplying voltage with a dc power supply. Up to a certain voltage the speed increases, but after a certain point the speed starts to drop down. Why does it happen? Do I have to change my transistors or my resistors?
Attached you will find the schematics, thank you.
In my ciruit resistors are 500 Ohm each.

That circuit can only work from 5V. You will damage the Arduino if you run it much higher
since 500 ohm resistors will soon be conducting too much current for the Arduino protection
diodes.

What voltage(s) do you want to run an H-bridge from?

Here's a more flexible design using a pre-driver to level-shift:

Note the two top switching transistors are swapped over in an X because each pre-driver
operates low and high switches on opposite halves of the bridge - I thought it was easier
to see the structure. The freewheel diodes happen to be implemented with a bridge
rectifier which is a little unusual too. Its a miniature design I played with a while back
works well with small motors and high performance surface mount transistors...

Thank you. I have to use almost 20-25 Volts. Is it ok if I use BD711 tansistor instead of bc847bs?
What about resistors, 1/4W is enough?

You need to calculate all the values according to your load, so first find out the
max stall current, max current from the supply, etc etc. As I said this is a small
circuit for little motors using surface mount transistors - it isn't intended for high power
use. The higher the power the more important protection circuitry will become.

So what do you suggest for higher voltage? Will a L298 work better than this circuit?

What’s the stall current of the motor? What’s the power supply?

The stall current is 1.8A. The power supply provide a maximum of 27V 0.18 A with no load.

That will be OK with L298.

Easier than mounting 6 transistors on a heatsink! BD711's are not efficient.

Of course a MOSFET bridge will be more efficient but with 20V supply the voltage loss in
a darlington driver isn't such a big thing - just means some heatsinking needed.

My circuit doesn't work properly, it overheats a lot. Could you please indicate me the schematics of a circuit with an L298?

Yes, its a darlington driver, it will need a heatsink and it will run hot.