I am traveling to Mexico from U.S. in April 18, 2018 and returning to U.S. from Mexico May 3, 2018. Question is upon my return my passport will expire July 18, 2018. Is that ok? Or does it need to expire 6 months from the return date?
No. This is a rule applied by some countries but not Mexico.
The official requirement page for Americans is here (in Spanish). There is no mention of a minimum validity. This matches my experience as a Canadian too which you can see is listed along with US citizens on the linked page (meaning the same rules apply).
In the US Government page you can see it also says that the passport must be valid at the time of entry.