This is a great question! Amphibians have two atria, or upper heart chambers, as do humans. However amphibians only have a single ventricle, so that the lower-oxygen blood returning from the body and the oxygenated blood coming from the lungs both go into that chamber, which then pumps the blood out of the heart. The secret to the amphibian coping mechanism is a special spiral valve within the heart, which directs the blood to one side or the other of the ventricle, and then to the correct vessel, with almost all of the oxygenated blood going to the aorta, and almost all of the deoxygenated blood to the pulmonary artery.
Also keep in mind that amphibians, being cold-blooded, have much lower oxygen needs than a similarly-sized endotherm has. They also have the capability of absorbing oxygen through the skin, so that the body circulation loop regains some of the oxygen that the muscles are absorbing.