Tanning beds use UV-A and UV-B rays to stimulate melanocytes in the skin to produce melanin, the pigment responsible for tanning. UV-A rays penetrate deeper into the skin, while UV-B rays affect the outer layers. This combination accelerates the tanning process but also increases the risk of skin damage.