There are numerous narrations about the bad deeds that cause duas to be rejected, but a few important narrations about the good deeds that actually cause them to be answered.
There is a hadith where three men were stuck in a cave. The three of them came together and made dua. The Prophet (pbuh) said they came together and called on a deed which they did only for Allahs (swt) sake. The first man made dua and described how he used to take milk to his parents every single night. He asked Oh Allah you know if I did this deed only for your sake then get us out of this situation. Then the boulder moved a little.
Here we learn the deeds which the other two men did for Allahs sake and if they got out of the cave!