Your central-air unit will run trouble-free for years—if you maintain it. Replace the air filter monthly to ensure adequate airflow. Check the compressor cabinet louvers; they can become clogged with dirt or leaves, which will make the unit work harder and overheat. Remove the cabinet cover and clear away the debris with a garden hose or shop vacuum. Also hose away dirt from coils and aluminum fins, as shown.
A final tip: Cool units run much more efficiently. So, shade the compressor with an overhead lattice panel, awning, or similar sunscreen.