There's multiple ways. The easiest would be to add a 'colour overlay' layer style.
- Double-click the empty area in the Layers palette, on the right of the layer's title. This will open the 'Layer Styles' dialogue box.
- Click the words 'Color Overlay' on the left -- just clicking the checkmark isn't enough.
- Click the colored rectangle in the mid-top of the dialogue box to pop up the colour picker and choose your colour.
- Click 'OK' to leave the colour picker and confirm, and 'OK' again to leave the layer style dialogue and confirm.
This is a non-destructive effect (you can revert or alter it as needed), but only if you save it as a *.psd file. If you save as *.png, it will just be the new colour.
A more direct way might be to destructively alter the pixels' colour:
- In the layer palette, seek out the word 'lock', and click on the checkerboard icon next to it. This will lock the layer's opacity: you can edit the layer as you like, but pixels will retain their current opacity value.
- Paint in your colour in any way you like.
- Unlock the transparency again to prevent stumping yourself later.
Since it's the loss of opacity anti-aliasing that creates your unwanted effect, locking the opacity will prevent this from happening.
As proposed by Larme in their comment, here is another non-destructive method:
- create a second layer above your layer and fill it with your colour. This can be a 'solid color' layer or just a pixel layer filled with the desired colour.
- right-click in the empty part of this layer in the layers palette, and choose 'Create Clipping Mask' OR hold Alt and click on the border between the two layers in the palette (you'll see a square and arrow cursor).
This way, the bottom layer's transparency act as a mask for the top layer.