How do I make sure the rotate axis don't rotate with the object?

I’m trying to make a first person camera by rotating the camera when the mouse moves, but when I rotate the camera in more than one axis, the rotation axes rotate with it, so the next time I rotate the camera it rotates in a horrible fashion. How do I mitigate this?

        camera.transform.Rotate(new Vector3(Input.GetAxis("Mouse Y") * sensitivity, Input.GetAxis("Mouse X") * sensitivity, 0));

I’m not familiar with angles in Unity yet, but I think what you want to do is update the axis rotation, not call transform.Rotate. Try:

camera.transform.rotation.eulerAngles = new Vector3(x, y, z);