I have been asked the following:

Question: Is it halachically permissible to spay or neuter a pet dog?

Answer: After reviewing the halachic sources, this is my understanding. A female dog may be spayed when there is a legitimate medical benefit, and modern veterinary medicine generally recognizes significant health benefits from the procedure. A male dog should first be evaluated by the veterinarian. If the veterinarian recommends neutering for a genuine medical reason, then I believe it is halachically permitted. If there is no significant medical indication and the reason is only behavior or population control, I recommend using a halachic workaround. The dog should be sold to a trusted non-Jew, who then independently has the procedure performed by a non-Jewish veterinarian. Afterward, the dog may be sold back. In my opinion, this legitimate halachic mechanism, together with the underlying medical benefit that exists to some degree in virtually every case, is sufficient to permit the procedure.