I have faced this same problem for literally years; sometimes it works correctly for weeks or months, and then without warning, messages on my Mac almost randomly fall out of sync with my iPhone. This occurs with messages from both iPhone and Android apps, and the sync issues happen on both Intel and Apple Silicon chips. I have seen all the usual suggestions for fixing the problem, but I believe I have found one of the reasons why it is happening. After receiving a message this morning on my iPhone from another iPhone user, I turned on my Mac and started the Messages app. The message on my phone did not appear on the Mac, so I did the following: 1) I went to the Mac system settings for iCloud -> Messages and used the "sync now" button, noting the number of messages that it identified, but the missing message did not appear in the Messages app. 2) Next, I did the same thing on the iPhone, but before syncing, I also noticed that it gave the last sync time as 16 hours earlier (that's right--16 hrs that my phone had not synced messages with iCloud!). After syncing was complete, it showed a different number of messages than indicated on the Mac. 3) Finally, I returned to the Mac settings and performed the sync again, and this time, the number of messages matched the iPhone, and the missing message appeared in Mac messages. Conclusion: the iPhone's failure to sync for 16 hrs prevented the Mac from getting the correct messages. It's interesting also that this problem virtually never happens in reverse: if I send a message from the Mac, the iPhone always gets it instantly.