The United States gained control of the Philippines in 1898, following the Spanish-American War. Spain ceded the Philippines to the U.S. under the Treaty of Paris, signed on December 10, 1898, which formally ended the war. In exchange, the U.S. paid Spain $20 million.
This transfer of control did not go uncontested. Filipino revolutionaries, who had been fighting for independence from Spain and had briefly declared the First Philippine Republic in 1898 under Emilio Aguinaldo, resisted American rule. This led to the Philippine-American War (1899–1902), a brutal conflict that resulted in the deaths of hundreds of thousands of Filipinos, mostly civilians, through combat, disease, and famine. Although major combat operations ended by 1902, sporadic resistance continued for several more years in some regions.
Following the war, the Philippines became an American colony, administered as an unincorporated territory. The U.S. gradually introduced local self-governance, and in 1935 the Philippines became a self-governing commonwealth with the promise of full independence within ten years, under the Tydings-McDuffie Act of 1934.
Japan occupied the Philippines during World War II from 1942 to 1945, interrupting American control. After the U.S. and Filipino forces recaptured the islands, the United States formally granted the Philippines full independence on July 4, 1946, in accordance with the terms set out in the Tydings-McDuffie Act, ending nearly five decades of American rule.
So while 1898 marks the year the U.S. formally acquired the Philippines from Spain, actual American control was established gradually and violently through the Philippine-American War, and it lasted until Philippine independence in 1946.