The hadith can be found in a lot of hadith compilations:
Narrated 'Abdullah bin 'Amr bin Al-'As:
Allah's Messenger (ﷺ) said to me, "O 'Abdullah! Have I not been informed that you fast during the day and offer prayers all the night." 'Abdullah replied, "Yes, O Allah's Messenger (ﷺ)!" The Prophet (ﷺ) said, "Don't do that; fast for few days and then give it up for few days, offer prayers and also sleep at night, as your body has a right on you, and your wife has a right on you, and your guest has a right on you. And it is sufficient for you to fast three days in a month, as the reward of a good deed is multiplied ten times, so it will be like fasting throughout the year." I insisted (on fasting) and so I was given a hard instruction. I said, "O Allah's Messenger (ﷺ)! I have power." The Prophet (ﷺ) said, "Fast like the fasting of the Prophet (ﷺ) David and do not fast more than that." I said, "How was the fasting of the Prophet (ﷺ) of Allah, David?" He said, "Half of the year," (i.e. he used to fast on every alternate day).
Afterwards when 'Abdullah became old, he used to say, "It would have been better for me if I had accepted the permission of the Prophet (which he gave me i.e. to fast only three days a month).
(Sahih al-Bukhari, Sahih Muslim)
There are longer versions like in Sahih Muslim, see also here a choice of narrations made by imam an-Nawawi in his Riyad as-Saliheen)