rule = Sqrt[expr_^2] :> expr;
Sqrt[x^2] /. rule
which is what is desired (regardless of formal correctness).
On the other hand, writing:
Sqrt[x^2 y] /. rule
How can I generalize the above rule so that it also applies in the second case?